Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Like that (avoid using var is my best advice)

sage: eqsys = a0*(t+1)-1
sage: sln = solve(SR(eqsys), SR(a0),solution_dict=True); sln
[{a0: 1/(t + 1)}]
sage: eqsys.subs(sln)
t*a0 + a0 - 1
sage: eqsys.subs(sln).parent()
Fraction Field of Multivariate Polynomial Ring in t, a0 over Rational Field

Then you should use subs on every coefficient

Like that (avoid using var is my best advice)

sage: eqsys = a0*(t+1)-1
sage: sln = solve(SR(eqsys), SR(a0),solution_dict=True); SR(a0),solution_dict=True)[0]; sln
[{a0: 1/(t + 1)}]
sage: eqsys.subs(sln)
t*a0 + a0 - 1
sage: eqsys.subs(sln).parent()
Fraction Field of Multivariate Polynomial Ring in t, a0 over Rational Field

Then you should use subs on every coefficient

Like that (avoid using var is my best advice)

sage: eqsys = a0*(t+1)-1
sage: sln = solve(SR(eqsys), SR(a0),solution_dict=True)[0]; sln
[{a0: {a0: 1/(t + 1)}]
1)}
sage: eqsys.subs(sln)
t*a0 + a0 - 1
sage: eqsys.subs(sln).parent()
Fraction Field of Multivariate Polynomial Ring eqsys.subs({QQt(a): QQt(b) for a, b in t, a0 over Rational Field
sln.items()})
0

A bit heavy of course.

Then you should use subs on every coefficient