First time here? Check out the FAQ!

Ask Your Question
1

How convert a polynomial in a power series?

asked 8 years ago

Peter Luschny gravatar image

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 8 years ago

tmonteil gravatar image

You can try to convert g as an element of the ring R by calling R(g) (it is a general syntax):

sage: G = R(g)
sage: G
1 - x + x^2
sage: G.parent()
Power Series Ring in x over Integer Ring
sage: G.inverse()
1 + x - x^3 - x^4 + x^6 + x^7 - x^9 - x^10 + x^12 + x^13 - x^15 - x^16 + x^18 + x^19 + O(x^20)
sage: G.inverse().list()
[1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1]
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 8 years ago

Seen: 445 times

Last updated: Dec 31 '16