ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 06 Nov 2017 04:29:40 -0600How can I get back an expression for free variables in solve function.http://ask.sagemath.org/question/39396/how-can-i-get-back-an-expression-for-free-variables-in-solve-function/I have a number of linear equations on some symbols A,B,C,D,E,F,G. When I solve them in Sagemath, I get some free variables in the solution.
$A,B,C,D,E,F,G=var('A,B,C,D,E,F,G')$
$eqns=[A+B==0,C+D+E==0,F+G==0,A+E-F==0]$
$solution=solve(eqns,A,B,C,D,E,F,G)$
Sage gives the following solution:
$[[A == r1, B == -r1, C == r1 - r2 - r3, D == r3, E == -r1 + r2, F == r2, G == -r2]]$
Now I can ask Sage to give me an expression of any combination of the symbols, for example:
$(A+C).subs(solution)$, then I get $2*r1 - r2 - r3$.
For my purpose I would now like to have an expression for any of the free variables. If I assign $r1=var('r1')$ and ask Sage $s1.subs(solution)$ I get back $r1$ again. But I would lik to get back an expression in terms of $A,B,C,D,E,F,G$.
Any suggestions on how to do this?TheBeiramMon, 06 Nov 2017 04:29:40 -0600http://ask.sagemath.org/question/39396/