fmpq_series – power series over rational numbers

class flint.fmpq_series(val=None, den=None, prec=None)

Approximate truncated power series with rational coefficients.

>>> from flint import fmpq_series, ctx
>>> ctx.cap = 10
>>> fmpq_series([1,2,3])
1 + 2*x + 3*x^2 + O(x^10)
>>> fmpq_series([1,2,3], prec=2)
1 + 2*x + O(x^2)
>>> x = fmpq_series([0,1])
>>> x
x + O(x^10)
>>> 1/(x+1)
1 + (-1)*x + x^2 + (-1)*x^3 + x^4 + (-1)*x^5 + x^6 + (-1)*x^7 + x^8 + (-1)*x^9 + O(x^10)
>>> x.sin()
x + (-1/6)*x^3 + 1/120*x^5 + (-1/5040)*x^7 + 1/362880*x^9 + O(x^10)

Elements can have greater or less precision than the context’s cap but operations will be truncated to cap terms.

asin(s)
asinh(s)
atan(s)
atanh(s)
coeffs(self)
cos(s)
cosh(s)
denom(self)
derivative(s)
exp(s)
integral(s)
inv(s)
length(self) long
log(s)
numer(self)
property p

fmpq_series.numer(self)

prec

The term precision of the finitely approximated series.

>>> from flint import fmpq_series, ctx
>>> ctx.cap = 10
>>> s = fmpq_series([1,2])
>>> s
1 + 2*x + O(x^10)
>>> s.prec
10
>>> s2 = fmpq_series([1,2], prec=3)
>>> s2
1 + 2*x + O(x^3)
>>> s2.prec
3
property q

fmpq_series.denom(self)

repr(self, **kwargs)
reversion(s)

Returns the power series reversion (compositional inverse) of s.

>>> from flint import fmpq_series, ctx
>>> ctx.cap = 10
>>> x = fmpq_series([0,1]); print((x/2-x**2).reversion())
2*x + 8*x^2 + 64*x^3 + 640*x^4 + 7168*x^5 + 86016*x^6 + 1081344*x^7 + 14057472*x^8 + 187432960*x^9 + O(x^10)
rsqrt(s)
sin(s)
sinh(s)
sqrt(s)
str(self, **kwargs)
tan(s)
tanh(s)
valuation(self)