Ask Your Question
1

How convert a polynomial in a power series?

asked 2016-12-31 11:43:04 +0200

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-12-31 13:16:28 +0200

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]
edit flag offensive delete link more

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: 2016-12-31 11:43:04 +0200

Seen: 312 times

Last updated: Dec 31 '16