Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Restarting the session also resets the $r_j$ Expression instances. The code cannot produce the solution in the form $b=b$ instead of $b=r_{39}$, and if it would, then i would like the other version.

If we know which variables are relevant, we could try to solve then only with respect to those variables. For instance:

sage: var('a,b,c');
sage: solve( [ a+b+c == 4, a+b-c == 5], [a, b] )
[]
sage: solve( [ a+b+c == 4, a+b-c == 5], [a, c] )
[[a == -b + 9/2, c == (-1/2)]]
sage: solve( [ a+b+c == 4, a+b-c == 5], [b, c] )
[[b == -a + 9/2, c == (-1/2)]]

Or the extended matrix of the system may give the necessary information.

A more fancy way to get the "relevant equations" would be to use the ideal generated by the equations, for instance:

sage: R.<a,b,c> = PolynomialRing( QQ )
sage: R
Multivariate Polynomial Ring in a, b, c over Rational Field
sage: J = R.ideal( [ a+b+c - 4, a+b-c -5 ] )
sage: J.groebner_basis()
[a + b - 9/2, c + 1/2]

and the above result can be digested as follows: The given equations $a+b+c - 4=0$, $a+b-c -5=0$ are equivalent with the two (simpler) equations $a + b - 9/2=0$, $c + 1/2=0$.