| 1 | initial version |
Here is a possibility:
sage: var('a x')
(a, x)
sage: f = a*x^3+1
sage: f.parent()
Symbolic Ring
sage: q = f.polynomial(SR)
sage: q
a*x^3 + 1
sage: q.parent()
Multivariate Polynomial Ring in a, x over Symbolic Ring
sage: q.variables()
(a, x)
So, at this point you got a polynomial with coefficients in SR but with both a and x as polynomial variables. Hence, it is not possible to send it into the ring R:
sage: R.<x> = SR[]
sage: R(q)
TypeError: not a constant polynomial
So, you have to substitute the polynomial variable a of q into the symbolic variable a:
sage: s = q.subs(a=SR.var('a'))
sage: s.parent()
Multivariate Polynomial Ring in a, x over Symbolic Ring
sage: P = R(s)
sage: P
a*x^3 + 1
sage: P.parent()
Univariate Polynomial Ring in x over Symbolic Ring
sage: P.variables()
(x,)
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.