I have something like
solutions := solve ( {eqn1=0, eqn2=0, eqn3=0, eqn4=0, ... } )
which returns something like:
solutions := {Ax = -.2312688085, Ay = -7.770329620, Bx = -19.76873119, ....}
How can I access and save each solution?
Is “Ax := solutions[1];”, and so on, the only way?
Although solutions[1] doesn’t access to -.2312688085 in the above example, but a kind of string “Ax = -.2312688085”, so I end up having “Ax := Ax = -.2312688085”
The
evalcommand allows you to use the solution just as if Ax,Ay,etc had been assigned, when evaluating other expressions involving those names. You get this effect without having to actually make the assignments (a benefit of which is that you can then create other equations in those variables without having to unassign their names).An alternative approach is to use
assigncommand to actually make assignments of the returned numeric values to those variable names. But this makes subsequent attempts to use those symbolic variables names more awkward — you’d have to first unassign them. You might not want to get into a awkward pattern of having to assign/unassign over and over.Using
evalis easier, I think. But you can try both, of course, and use what you prefer.Some examples might help: