I need to output the answers from solve into the variables named just as they were named in the solve equations. I have checked out this thread
Assign the results from a Solve to variable(s)
but this is more about one variable having different values being stored. So you extract one data at a time and all. What I want is basically have the output of this solve below stored to the variables i1, i2, i3 and i4 so I can use them in further calculations.
In: Solve[-I (i2 - i1) + 5 (i2 - i4) + I (i2 - i3) == 0 && I (i3 - i2) + i3 == 0 && 5 (i4 - i2) + 1 + I == 0 && i1 + 2 == 0, {i1, i2, i3, i4}] Out: {{i1 -> -2, i2 -> -2, i3 -> -1 - I, i4 -> -(11/5) - I/5}} I tried something like
{i1, i2, i3, i4} -> {-2, -2, -1 - I, -(11/5) - I/5} but then
in: I (i1 - i3) out: I (i1 - i3) is what I got. The capital I are basically the imaginary operator but it becomes that when I copy paste here.
PS. I am not using linear solvers here or, better yet, MATLAB because I don't want to go through the troublesome arithmetics of simplification to get the coefficients.
Solve, then you could useSolve[youreqautions, yourvariables] /. Rule -> Set. This will turn the list of rules returned bySolveinto a list of assignments to the variables. Note that once those variables have values assigned, yourSolveexpression will no longer work until the values are cleared. Again, I really would not recommend using this: you should rather save the solutions / rules returned bySolveand apply them whenever you need to inject the variable values in expressions. $\endgroup$