Skip to main content
Additional explanations.
Source Link
E. Chan-López
  • 33.7k
  • 3
  • 34
  • 54

Using MapIndexed:

f[sols_List]f[s_List] := MapIndexed[Set @@ {Symbol@ StringJoin@(ToString /@ {#1[[1]], First@#2#2[[1]]}), #1[[2]]} &, solss, {2}] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{x1, y1}, {x2, y2}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 

Or using MapIndexed and Subscript:

f[s_List] := MapIndexed[Set[Subscript[#1[[1]], #2[[1]]], #1[[2]]] &, s, {2}] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{Subscript[x, 1], Subscript[y, 1]}, {Subscript[x, 2], Subscript[y, 2]}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 

Using MapIndexed:

f[sols_List] := MapIndexed[Set @@ {Symbol@ StringJoin@(ToString /@ {#1[[1]], First@#2}), #1[[2]]} &, sols, {2}] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{x1, y1}, {x2, y2}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 

Using MapIndexed:

f[s_List] := MapIndexed[Set @@ {Symbol@ StringJoin@(ToString /@ {#1[[1]], #2[[1]]}), #1[[2]]} &, s, {2}] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{x1, y1}, {x2, y2}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 

Or using MapIndexed and Subscript:

f[s_List] := MapIndexed[Set[Subscript[#1[[1]], #2[[1]]], #1[[2]]] &, s, {2}] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{Subscript[x, 1], Subscript[y, 1]}, {Subscript[x, 2], Subscript[y, 2]}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 
Improved formatting and minor typos.
Source Link
E. Chan-López
  • 33.7k
  • 3
  • 34
  • 54

Using MapIndexed:

f[sols_List] := ReplaceAll[Rule[a_, b_]MapIndexed[Set :>@@ Set[a,{Symbol@ b]][MapIndexed[Rule[Symbol@ StringJoin@(ToString /@ {#1[[1]], #2[[1]]First@#2}), #1[[2]]]#1[[2]]} &, sols, {2}]]] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{x1, y1}, {x2, y2}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 

Using MapIndexed:

f[sols_List] := ReplaceAll[Rule[a_, b_] :> Set[a, b]][MapIndexed[Rule[Symbol@ StringJoin@(ToString /@ {#1[[1]], #2[[1]]}), #1[[2]]] &, sols, {2}]] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{x1, y1}, {x2, y2}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 

Using MapIndexed:

f[sols_List] := MapIndexed[Set @@ {Symbol@ StringJoin@(ToString /@ {#1[[1]], First@#2}), #1[[2]]} &, sols, {2}] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{x1, y1}, {x2, y2}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*) 
Source Link
E. Chan-López
  • 33.7k
  • 3
  • 34
  • 54

Using MapIndexed:

f[sols_List] := ReplaceAll[Rule[a_, b_] :> Set[a, b]][MapIndexed[Rule[Symbol@ StringJoin@(ToString /@ {#1[[1]], #2[[1]]}), #1[[2]]] &, sols, {2}]] f[Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]]; {{x1, y1}, {x2, y2}} (*{{(-11181 - Sqrt[2242057])/74498, 1/386 (13 - Sqrt[2242057])}, {(-11181 + Sqrt[2242057])/74498, 1/386 (13 + Sqrt[2242057])}}*)