Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Convert expression to univariate polynomial over symbolic ring properly

If I create polynomial like this

R.<x> = SR[]
var('a')
f = a*x^3+1

I get such list of variables

sage: f.variables()
(x,)

But how to convert existing expression to univariate polynomial over symbolic ring?

When I do like this

var('a')
f = a*x^3+1
P.<x> = SR[]

I get following output

sage: P(f).variables()
()
sage: SR['x'](f).variables()
()

How to convert f to polynomial in a right way with x as variable.