Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to simplify `solve` result ($r_i$ variables)?

I want to solve a system of linear equations (more variables than equations):

var('a, b, c')
eqn = [a+b+c==4, a+b-c==5]
s = solve(eqn, a, b, c); s

The result is shown like this:

$\left[\left[a = -r_{39} + \frac{9}{2}, b = r_{39}, c = \left(-\frac{1}{2}\right)\right]\right]$

But I would like to have a simplified representation, i.e., where $r_{39}$ in the first equation is replaced by $b$. Alternatively, is there a way to reset the counter of the $r_i$ variables? Each time I evaluate the code above, the counter is incremented.