Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How convert a polynomial in a power series?

Consider the following situation:

R.<x> = PowerSeriesRing(ZZ)
f = x^2 - x + 1
print f, f.parent()

g = cyclotomic_polynomial(6)
print g, g.parent()

which gives

1 - x + x^2 Power Series Ring in x over Integer Ring
x^2 - x + 1 Univariate Polynomial Ring in x over Integer Ring

Question: How can I convert a polynomial in a power series?

In the example above I would like to input a cyclotomic polynomial and get as output it's inverse when interpreted as a power series.

cyclotomic_polynomial(6).as_ps().inverse().list()
[1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1]

In the pseudo code above "as_ps()" indicates the missing link.