Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Coefficients of inversed polynomial

I want to lazily compute coefficients of inversed integer based polynomial.

For example, I have: $$ P = 1 - x $$ and I want to get formal power series of it's inverse: $$ \frac{1}{P} = \frac{1}{1-x} = 1 + x + x^2 + \dots $$

But actually, I would like to get the n-th coefficient of it.

How can I do it?

P.S: I tried the following code, but it computes only 20 coefficients:

sage:> F.<x> = PowerSeriesRing(ZZ); F
sage:> F([1])/(1-x)
1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^11 + x^12 + x^13 + x^14 + x^15 + x^16 + x^17 + x^18 + x^19 + O(x^20)

I think I can change precision every time I want to get a coefficient bigger than default 20, but it requires recomputing of that power series, so I want to know is there another way.