fmpz_series – power series over integers

class flint.fmpz_series(val=None, prec=None)

Power series with integer coefficients.

>>> from flint import fmpz_series, ctx
>>> ctx.cap = 10
>>> fmpz_series([1,2,3])
1 + 2*x + 3*x^2 + O(x^10)
>>> fmpz_series([1,2,3], prec=2)
1 + 2*x + O(x^2)
>>> fmpz_series([1,2,3], prec=2) + fmpz_series([1,2,3,4,5])
2 + 4*x + O(x^2)
>>> a = fmpz_series([1,2,3])
>>> (a+1)*(a-1) - a**2 + 1
0 + O(x^10)
coeffs(self)
length(self) long
prec

The term precision of the finitely approximated series.

>>> from flint import fmpz_series, ctx
>>> ctx.cap = 10
>>> s = fmpz_series([1,2])
>>> s
1 + 2*x + O(x^10)
>>> s.prec
10
>>> s2 = fmpz_series([1,2], prec=3)
>>> s2
1 + 2*x + O(x^3)
>>> s2.prec
3
repr(self, **kwargs)
reversion(s)

Power series reversion.

>>> from flint import fmpz_series, ctx
>>> ctx.cap = 10
>>> fmpz_series([0,1,-2,-3]).reversion()
x + 2*x^2 + 11*x^3 + 70*x^4 + 503*x^5 + 3864*x^6 + 31092*x^7 + 258654*x^8 + 2206655*x^9 + O(x^10)
>>> fmpz_series([0,1,-2,-3]).reversion()(fmpz_series([0,1,-2,-3]))
x + O(x^10)
>>> fmpz_series([1,2,3]).reversion()
Traceback (most recent call last):
  ...
ValueError: power series reversion must have valuation 1
str(self, **kwargs)
valuation(self)

Returns the valuation of this power series. If there are no known nonzero coefficients, returns -1.

>>> from flint import fmpz_series, ctx
>>> ctx.cap = 10
>>> s1 = fmpz_series([1,2,3])
>>> s1
1 + 2*x + 3*x^2 + O(x^10)
>>> s1.valuation()
0
>>> s2 = fmpz_series([0,0,0,1,2,3])
>>> s2
x^3 + 2*x^4 + 3*x^5 + O(x^10)
>>> s2.valuation()
3
>>> s3 = fmpz_series([])
>>> s3
0 + O(x^10)
>>> s3.valuation()
-1