ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 06 Feb 2014 00:04:20 +0100Two questions about parameters in solutionshttps://ask.sagemath.org/question/10997/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:
[[x=?r1+3,y=r1]]
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?AlasdairThu, 06 Feb 2014 00:04:20 +0100https://ask.sagemath.org/question/10997/