Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Two questions about parameters in solutions

In the Sage documentation, this example is given:

 sols = solve([x+y == 3, 2*x+2*y == 6],x,y); sols

of a solution which includes an extra parameter:

  1. If I run this comand again, the solution is given with r2, then again with r3 etc. Is it possible to "reset" the parameter number?
  2. How does one substitute a particular value for this parameter? I can do it by iterating through the list and using rhs():

    [i.rhs().subs(r1=1/2) for i in sols]

    or by setting solution_dict=True and fiddling another way:

    [sols[i].subs(r1=1/2) for i in [x,y]]

Neither of these seem particularly elegant - is there a more "natural" way?