Ask Your Question

Revision history [back]

Not satisfactory, but you can do:

sage: eq.subs({B: sqrt(17)}).subs({sqrt(17):B})
691254*B*x^15 + 397953*x^16 + 244005777*x^14

Not satisfactory, but you can do:

sage: eq.subs({B: sqrt(17)}).subs({sqrt(17):B})
691254*B*x^15 + 397953*x^16 + 244005777*x^14

That said, since your expressions are polynomials (they do not involve things like log, sin,...), you can work in a well defined polynomial ring:

sage: R.<B,x,y> = QQ[]
sage: R
Multivariate Polynomial Ring in B, x, y over Rational Field
sage: eq.mod(B^2-17)
691254*B*x^15 + 397953*x^16 + 244005777*x^14