Ask Your Question

Revision history [back]

Some data is missing to reproduce your context. So let me simulate one:

Your symbolic function:

sage: var('w,x,y')
(w, x, y)
sage: g = w+2*x+y^2
sage: g
y^2 + w + 2*x
sage: g.parent()
Symbolic Ring

Your polynomial ring:

sage: R.<w,x,y,z>=QQ[]

You can directly convert the symbolic expression as an element of the ring:

sage: R(g)
y^2 + w + 2*x
sage: R(g).parent()
Multivariate Polynomial Ring in w, x, y, z over Rational Field

If you have a polynomial with less variables, it is also doable:

sage: g.polynomial(QQ)
y^2 + w + 2*x
sage: g.polynomial(QQ).parent()
Multivariate Polynomial Ring in w, x, y over Rational Field
sage: R(g.polynomial(QQ))
y^2 + w + 2*x
sage: R(g.polynomial(QQ)).parent()
Multivariate Polynomial Ring in w, x, y, z over Rational Field