1 | initial version |
For this purpose it is more convenient to work in a polynomial ring than in the symbolic ring:
sage: x, y, z = var("x y z")
sage: poly = x^3*y*z + x^2*y^2 + 3*x^3 + 2*x^2 + x*y + x*z + 1
sage: A = PolynomialRing(QQ, names='y,z')
sage: B = PolynomialRing(A, names='x')
sage: B(poly)
(y*z + 3)*x^3 + (y^2 + 2)*x^2 + (y + z)*x + 1
Or, avoiding the symbolic ring altogether:
sage: A.<y,z> = PolynomialRing(QQ)
sage: B.<x> = PolynomialRing(A)
sage: poly = x^3*y*z + x^2*y^2 + 3*x^3 + 2*x^2 + x*y + x*z + 1
sage: poly
(y*z + 3)*x^3 + (y^2 + 2)*x^2 + (y + z)*x + 1
You can go back from a polynomial ring element f
to the symbolic ring by SR(f)
.