0
$\begingroup$

I want to solve the following equation in a loop:

m={{Indexed[c, {1, 1}], 0, Indexed[c, {1, 3}], 0}, {0, 
  Indexed[c, {2, 2}], 0, Indexed[c, {1, 3}]}, {0, -Indexed[c, {2, 2}],
   0, -Indexed[c, {1, 3}]}, {Indexed[c, {1, 1}], 
  0, -Indexed[c, {1, 3}], 0}}

For[n = 1, n < 5, n++,
 v = m[[All, n]];
 sol = Solve[v . Transpose[v] == 1][[2]][[1]];
 Print[sol]
 ]

Is there a way to stack all the Solve outputs in only one replacement list such as Rules={sol[1],sol[2],sol[3],sol[4]}

$\endgroup$
1
  • $\begingroup$ Try: Reap[ For[n = 1, n < 5, n++, v = m[[All, n]]; Sow[Solve[v . Transpose[v] == 1][[2]][[1]]]; ]][[2, 1]] $\endgroup$ Jun 17, 2023 at 6:30

0