Laurent Series

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(GF(7), 't'); R
Laurent Series Ring in t over Finite Field of size 7
sage: f = 1/(1-t+O(t^10)); f
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + t^9 + O(t^10)

Laurent series are immutable:

sage: f[2]
1
sage: f[2] = 5
...
IndexError: Laurent series are immutable    

We compute with a Laurent series over the complex mpfr numbers.

sage: K.<q> = Frac(CC[['q']])
sage: K
Laurent Series Ring in q over Complex Field with 53 bits of precision
sage: q
1.00000000000000*q

Saving and loading.

sage: loads(q.dumps()) == q
True
sage: loads(K.dumps()) == K
True

IMPLEMENTATION: Laurent series in Sage are represented internally as a power of the variable times the unit part (which need not be a unit - it’s a polynomial with nonzero constant term). The zero Laurent series has unit part 0.

AUTHORS:

  • William Stein: original version
  • David Joyner (2006-01-22): added examples
  • Robert Bradshaw (2007-04): optimizations, shifting
  • Robert Bradshaw: Cython version
class sage.rings.laurent_series_ring_element.LaurentSeries

A Laurent Series.

__call__()

Compute value of this Laurent series at x.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(ZZ)
sage: f = t^(-2) + t^2 + O(t^8)
sage: f(2)
17/4
sage: f(-1)
2
sage: f(1/3)
82/9
__copy__()
__delitem__()
x.__delitem__(y) <==> del x[y]
__eq__()
x.__eq__(y) <==> x==y
__ge__()
x.__ge__(y) <==> x>=y
__getitem__()

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = -5/t^(10) + t + t^2 - 10/3*t^3; f
-5*t^-10 + t + t^2 - 10/3*t^3
sage: f[-10]
-5
sage: f[1]
1
sage: f[3]
-10/3
sage: f[-9]
0
__getslice__()

x.__getslice__(i, j) <==> x[i:j]

Use of negative indices is not supported.

__gt__()
x.__gt__(y) <==> x>y
__hash__()
x.__hash__() <==> hash(x)
__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
__iter__()

Iterate through the coefficients from the first nonzero one to the last nonzero one.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3; f
-5*t^-2 + t + t^2 - 10/3*t^3
sage: for a in f: print a
-5
0
0
1
1
-10/3
__le__()
x.__le__(y) <==> x<=y
__lshift__()
__lt__()
x.__lt__(y) <==> x<y
__ne__()
x.__ne__(y) <==> x!=y
__neg__()
sage: R.<t> = LaurentSeriesRing(QQ)
sage: -(1+t^5)
-1 - t^5
sage: -(1/(1+t+O(t^5)))
-1 + t - t^2 + t^3 - t^4 + O(t^5)
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
__nonzero__()
x.__nonzero__() <==> x != 0
__normalize()
A Laurent series is a pair (u(t), n), where either u=0 (to some precision) or u is a unit. This pair corresponds to t^n\cdot u(t).
__pow__()
x.__pow__(y[, z]) <==> pow(x, y[, z])
__reduce__()
__rlshift__()
x.__rlshift__(y) <==> y<<x
__rpow__()
y.__rpow__(x[, z]) <==> pow(x, y[, z])
__rrshift__()
x.__rrshift__(y) <==> y>>x
__rshift__()
__setitem__()
x.__setitem__(i, y) <==> x[i]=y
_add_()

Add two power series with the same parent.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: t + t
2*t
sage: f = 1/t + t^2 + t^3 - 17/3 * t^4 + O(t^5)
sage: g = 1/(1-t + O(t^7)); g
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + O(t^7)
sage: f + g
t^-1 + 1 + t + 2*t^2 + 2*t^3 - 14/3*t^4 + O(t^5)
sage: f + 0
t^-1 + t^2 + t^3 - 17/3*t^4 + O(t^5)
sage: 0 + f
t^-1 + t^2 + t^3 - 17/3*t^4 + O(t^5)
sage: R(0) + R(0)
0
sage: (t^3 + O(t^10)) + (t^-3 +O(t^9))
t^-3 + t^3 + O(t^9)

ALGORITHM: Shift the unit parts to align them, then add.

_derivative()

The formal derivative of this Laurent series with respect to var.

If var is None or the generator of this ring, it’s the formal derivative as expected. Otherwise, _derivative(var) gets called recursively on each coefficient.

See also

derivative()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = x^2 + 3*x^4 + O(x^7)
sage: f._derivative()
2*x + 12*x^3 + O(x^6)
sage: f._derivative(x)
2*x + 12*x^3 + O(x^6)
sage: g = 1/x^10 - x + x^2 - x^4 + O(x^8)
sage: g._derivative()
-10*x^-11 - 1 + 2*x - 4*x^3 + O(x^7)

Differentiating with respect to something other than the generator gets recursed into the base ring:

sage: R.<t> = PolynomialRing(ZZ)
sage: S.<x> = LaurentSeriesRing(R)
sage: f = 2*t/x + (3*t^2 + 6*t)*x + O(x^2)
sage: f._derivative(t)
2*x^-1 + (6*t + 6)*x + O(x^2)
_div_()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = x + x^2 + 3*x^4 + O(x^7)
sage: g = 1/x^7 - x + x^2 - x^4 + O(x^8)
sage: f/x
1 + x + 3*x^3 + O(x^6)
sage: f/g
x^8 + x^9 + 3*x^11 + O(x^14)
_iadd_()

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = t+t
sage: f += t; f
3*t
sage: f += O(t^5); f
3*t + O(t^5)
_ilmul_()
_im_gens_()
_imul_()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = 1/x^3 + x + x^2 + 3*x^4 + O(x^7)
sage: g = 1 - x + x^2 - x^4 + O(x^8)
sage: f *= g; f
x^-3 - x^-2 + x^-1 + 4*x^4 + O(x^5)
_latex_()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = (17/2)*x^-2 + x + x^2 + 3*x^4 + O(x^7)
sage: latex(f)
\frac{\frac{17}{2}}{x^{2}} + x + x^{2} + 3x^{4} + O(x^{7})

Verify that trac #6656 has been fixed:

sage: R.<a,b>=PolynomialRing(QQ)
sage: T.<x>=LaurentSeriesRing(R)
sage: y = a*x+b*x
sage: y._latex_()
'\\left(a + b\\right)x'
sage: latex(y)
\left(a + b\right)x
_lmul_()
_mul_()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = 1/x^3 + x + x^2 + 3*x^4 + O(x^7)
sage: g = 1 - x + x^2 - x^4 + O(x^8)
sage: f*g
x^-3 - x^-2 + x^-1 + 4*x^4 + O(x^5)
_repr_()

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: (2 + (2/3)*t^3).__repr__()
'2 + 2/3*t^3'
_rmul_()
_sub_()

Subtract two power series with the same parent.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: t - t
0
sage: t^5 + 2 * t^-5
2*t^-5 + t^5

ALGORITHM: Shift the unit parts to align them, then subtract.

_unsafe_mutate()

Sage assumes throughout that commutative ring elements are immutable. This is relevant for caching, etc. But sometimes you need to change a Laurent series and you really know what you’re doing. That’s when this function is for you.

EXAMPLES:

add_bigoh()

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = t^2 + t^3 + O(t^10); f
t^2 + t^3 + O(t^10)
sage: f.add_bigoh(5)
t^2 + t^3 + O(t^5)
change_ring()
coefficients()

Return the nonzero coefficients of self.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3
sage: f.coefficients()
[-5, 1, 1, -10/3]
common_prec()

Returns minimum precision of f and self.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = t^(-1) + t + t^2 + O(t^3)
sage: g = t + t^3 + t^4 + O(t^4)
sage: f.common_prec(g)
3
sage: g.common_prec(f)
3
sage: f = t + t^2 + O(t^3)
sage: g = t^(-3) + t^2
sage: f.common_prec(g)
3
sage: g.common_prec(f)
3
sage: f = t + t^2
sage: f = t^2
sage: f.common_prec(g)
+Infinity
sage: f = t^(-3) + O(t^(-2))
sage: g = t^(-5) + O(t^(-1))
sage: f.common_prec(g)
-2
degree()

Return the degree of a polynomial equivalent to this power series modulo big oh of the precision.

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: g = x^2 - x^4 + O(x^8)
sage: g.degree()
4
sage: g = -10/x^5 + x^2 - x^4 + O(x^8)
sage: g.degree()
4
derivative()

The formal derivative of this Laurent series, with respect to variables supplied in args.

Multiple variables and iteration counts may be supplied; see documentation for the global derivative() function for more details.

See also

_derivative()

EXAMPLES:

sage: R.<x> = LaurentSeriesRing(QQ)
sage: g = 1/x^10 - x + x^2 - x^4 + O(x^8)
sage: g.derivative()
-10*x^-11 - 1 + 2*x - 4*x^3 + O(x^7)
sage: g.derivative(x)
-10*x^-11 - 1 + 2*x - 4*x^3 + O(x^7)
sage: R.<t> = PolynomialRing(ZZ)
sage: S.<x> = LaurentSeriesRing(R)
sage: f = 2*t/x + (3*t^2 + 6*t)*x + O(x^2)
sage: f.derivative()
-2*t*x^-2 + (3*t^2 + 6*t) + O(x)
sage: f.derivative(x)
-2*t*x^-2 + (3*t^2 + 6*t) + O(x)
sage: f.derivative(t)
2*x^-1 + (6*t + 6)*x + O(x^2)
exponents()

Return the exponents appearing in self with nonzero coefficients.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3
sage: f.exponents()
[-2, 1, 2, 3]
integral()

The formal integral of this Laurent series with 0 constant term.

EXAMPLES: The integral may or may not be defined if the base ring is not a field.

sage: t = LaurentSeriesRing(ZZ, 't').0
sage: f = 2*t^-3 + 3*t^2 + O(t^4)
sage: f.integral()
-t^-2 + t^3 + O(t^5)
sage: f = t^3
sage: f.integral()
...
ArithmeticError: Coefficients of integral cannot be coerced into the base ring

The integral of 1/t is \log(t), which is not given by a Laurent series:

sage: t = Frac(QQ[['t']]).0
sage: f = -1/t^3 - 31/t + O(t^3)
sage: f.integral()
...
ArithmeticError: The integral of is not a Laurent series, since t^-1 has nonzero coefficient.

Another example with just one negative coefficient:

sage: A.<t> = QQ[[]]
sage: f = -2*t^(-4) + O(t^8)
sage: f.integral()
2/3*t^-3 + O(t^9)
sage: f.integral().derivative() == f
True
is_unit()

Returns True if this is Laurent series is a unit in this ring.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: (2+t).is_unit()
True
sage: f = 2+t^2+O(t^10); f.is_unit()
True
sage: 1/f
1/2 - 1/4*t^2 + 1/8*t^4 - 1/16*t^6 + 1/32*t^8 + O(t^10)
sage: R(0).is_unit()
False
sage: R.<s> = LaurentSeriesRing(ZZ)
sage: f = 2 + s^2 + O(s^10)
sage: f.is_unit()
False
sage: 1/f
...
ArithmeticError: division not defined

ALGORITHM: A Laurent series is a unit if and only if its “unit part” is a unit.

is_zero()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = 1/x + x + x^2 + 3*x^4 + O(x^7)
sage: f.is_zero()
0
sage: z = 0*f
sage: z.is_zero()
1
list()

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ)
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3
sage: f.list()
[-5, 0, 0, 1, 1, -10/3]
power_series()

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(ZZ)
sage: f = 1/(1-t+O(t^10)); f.parent()
Laurent Series Ring in t over Integer Ring
sage: g = f.power_series(); g
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + t^9 + O(t^10)
sage: parent(g)
Power Series Ring in t over Integer Ring
sage: f = 3/t^2 +  t^2 + t^3 + O(t^10)
sage: f.power_series()
...
ArithmeticError: self is a not a power series
prec()

This function returns the n so that the Laurent series is of the form (stuff) + O(t^n). It doesn’t matter how many negative powers appear in the expansion. In particular, prec could be negative.

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = x^2 + 3*x^4 + O(x^7)
sage: f.prec()
7
sage: g = 1/x^10 - x + x^2 - x^4 + O(x^8)
sage: g.prec()
8
shift()

Returns this laurent series multiplied by the power t^n. Does not change this series.

Note

Despite the fact that higher order terms are printed to the right in a power series, right shifting decreases the powers of t, while left shifting increases them. This is to be consistent with polynomials, integers, etc.

EXAMPLES:

sage: R.<t> = LaurentSeriesRing(QQ['y'])
sage: f = (t+t^-1)^4; f
t^-4 + 4*t^-2 + 6 + 4*t^2 + t^4
sage: f.shift(10)
t^6 + 4*t^8 + 6*t^10 + 4*t^12 + t^14
sage: f >> 10
t^-14 + 4*t^-12 + 6*t^-10 + 4*t^-8 + t^-6
sage: t << 4
t^5
sage: t + O(t^3) >> 4
t^-3 + O(t^-1)

AUTHORS:

  • Robert Bradshaw (2007-04-18)
truncate()
Returns the laurent series of degree ` < n` which is equivalent to self modulo x^n.
truncate_neg()

Returns the laurent series equivalent to self except without any degree n terms.

This is equivalent to `self - self.truncate(n)`.

valuation()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = 1/x + x^2 + 3*x^4 + O(x^7)
sage: g = 1 - x + x^2 - x^4 + O(x^8)
sage: f.valuation()
-1
sage: g.valuation()
0
valuation_zero_part()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = x + x^2 + 3*x^4 + O(x^7)
sage: f/x
1 + x + 3*x^3 + O(x^6)
sage: f.valuation_zero_part()
1 + x + 3*x^3 + O(x^6)
sage: g = 1/x^7 - x + x^2 - x^4 + O(x^8)
sage: g.valuation_zero_part()
1 - x^8 + x^9 - x^11 + O(x^15)
variable()

EXAMPLES:

sage: x = Frac(QQ[['x']]).0
sage: f = 1/x + x^2 + 3*x^4 + O(x^7)
sage: f.variable()
'x'
sage.rings.laurent_series_ring_element.is_LaurentSeries()
sage.rings.laurent_series_ring_element.make_element_from_parent()

Previous topic

Laurent Series Rings

Next topic

Algebras

This Page