Multivariate Power Series

Construct and manipulate multivariate power series over a given commutative ring. Multivariate power series are implemented with total-degree precision.

EXAMPLES:

Power series arithmetic, tracking precision:

sage: R.<s,t> = PowerSeriesRing(ZZ); R
Multivariate Power Series Ring in s, t over Integer Ring

sage: f = 1 + s + 3*s^2; f
1 + s + 3*s^2
sage: g = t^2*s + 3*t^2*s^2 + R.O(5); g
s*t^2 + 3*s^2*t^2 + O(s, t)^5
sage: g = t^2*s + 3*t^2*s^2 + O(s, t)^5; g
s*t^2 + 3*s^2*t^2 + O(s, t)^5
sage: f = f.O(7); f
1 + s + 3*s^2 + O(s, t)^7
sage: f += s; f
1 + 2*s + 3*s^2 + O(s, t)^7
sage: f*g
s*t^2 + 5*s^2*t^2 + O(s, t)^5
sage: (f-1)*g
2*s^2*t^2 + 9*s^3*t^2 + O(s, t)^6
sage: f*g - g
2*s^2*t^2 + O(s, t)^5

sage: f*=s; f
s + 2*s^2 + 3*s^3 + O(s, t)^8
sage: f%2
s + s^3 + O(s, t)^8
sage: (f%2).parent()
Multivariate Power Series Ring in s, t over Ring of integers modulo 2

Comparisons: As with univariate power series, comparison of f and g is done up to the minimum precision of f and g.

sage: f = 1 + t + s + s*t + R.O(3); f
1 + s + t + s*t + O(s, t)^3
sage: g = s^2 + 2*s^4 - s^5 + s^2*t^3 + R.O(6); g
s^2 + 2*s^4 - s^5 + s^2*t^3 + O(s, t)^6
sage: f == g
False
sage: g == g.add_bigoh(3)
True
sage: f < g
False
sage: f > g
True

Calling:

sage: f = s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + R.O(5); f
s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + O(s, t)^5
sage: f(t,s)
s*t + t^2 + s*t^2 + t^3 + 3*s*t^3 + 3*t^4 + O(s, t)^5
sage: f(t^2,s^2)
s^2*t^2 + t^4 + s^2*t^4 + t^6 + 3*s^2*t^6 + 3*t^8 + O(s, t)^10
  • Substitution is defined only for elements of positive valuation, unless f has infinite precision:

    sage: f(t^2,s^2+1)
    Traceback (most recent call last):
    ...
    TypeError: Substitution defined only for elements of positive valuation,
    unless self has infinite precision.
    
    sage: g = f.truncate()
    sage: g(t^2,s^2+1)
    t^2 + s^2*t^2 + 2*t^4 + s^2*t^4 + 4*t^6 + 3*s^2*t^6 + 3*t^8
    sage: g(t^2,(s^2+1).O(3))
    t^2 + s^2*t^2 + 2*t^4 + O(s, t)^5
    
  • 0 has valuation +Infinity:

    sage: f(t^2,0)
    t^4 + t^6 + 3*t^8 + O(s, t)^10
    sage: f(t^2,s^2+s)
    s*t^2 + s^2*t^2 + t^4 + O(s, t)^5
    
  • Substitution of power series with finite precision works too:

    sage: f(s.O(2),t)
    s^2 + s*t + O(s, t)^3
    sage: f(f,f)
    2*s^4 + 4*s^3*t + 2*s^2*t^2 + 4*s^5 + 8*s^4*t + 4*s^3*t^2 + 16*s^6 +
    34*s^5*t + 20*s^4*t^2 + 2*s^3*t^3 + O(s, t)^7
    sage: t(f,f)
    s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + O(s, t)^5
    sage: t(0,f) == s(f,0)
    True
    
  • subs works as expected:

    sage: r0 = -t^2 - s*t^3 - 2*t^6 + s^7 + s^5*t^2 + R.O(10)   
    sage: r1 = s^4 - s*t^4 + s^6*t - 4*s^2*t^5 - 6*s^3*t^5 + R.O(10)
    sage: r2 = 2*s^3*t^2 - 2*s*t^4 - 2*s^3*t^4 + s*t^7 + R.O(10)
    sage: r0.subs({t:r2,s:r1})  
    -4*s^6*t^4 + 8*s^4*t^6 - 4*s^2*t^8 + 8*s^6*t^6 - 8*s^4*t^8 - 4*s^4*t^9
    + 4*s^2*t^11 - 4*s^6*t^8 + O(s, t)^15
    sage: r0.subs({t:r2,s:r1}) == r0(r1,r2)
    True
    
  • construct ring homomorphisms from one power series ring to another:

    sage: A.<a,b> = PowerSeriesRing(QQ)
    sage: X.<x,y> = PowerSeriesRing(QQ)
    
    sage: phi = Hom(A,X)([x,2*y]); phi
    Ring morphism:
      From: Multivariate Power Series Ring in a, b over Rational Field
      To:   Multivariate Power Series Ring in x, y over Rational Field
      Defn: a |--> x
            b |--> 2*y
    
    sage: phi(a+b+3*a*b^2 + A.O(5))
    x + 2*y + 12*x*y^2 + O(x, y)^5
    

Inversion:

sage: h = 1 + s + t + s*t + s^2*t^2 + 3*s^4 + 3*s^3*t + R.O(5); 
sage: k = h^-1; k
1 - s - t + s^2 + s*t + t^2 - s^3 - s^2*t - s*t^2 - t^3 - 2*s^4 -
2*s^3*t + s*t^3 + t^4 + O(s, t)^5
sage: h*k
1 + O(s, t)^5

sage: f = 1 - 5*s^29 - 5*s^28*t + 4*s^18*t^35 + \
4*s^17*t^36 - s^45*t^25 - s^44*t^26 + s^7*t^83 + \
s^6*t^84 + R.O(101)
sage: h = 1/f; h  
1 + 5*s^29 + 5*s^28*t - 4*s^18*t^35 - 4*s^17*t^36 + 25*s^58 + 50*s^57*t
+ 25*s^56*t^2 + s^45*t^25 + s^44*t^26 - 40*s^47*t^35 - 80*s^46*t^36
- 40*s^45*t^37 + 125*s^87 + 375*s^86*t + 375*s^85*t^2 + 125*s^84*t^3
- s^7*t^83 - s^6*t^84 + 10*s^74*t^25 + 20*s^73*t^26 + 10*s^72*t^27
+ O(s, t)^101
sage: h*f
1 + O(s, t)^101

AUTHORS:

  • Niles Johnson (07/2010): initial code
  • Simon King (08/2012): Use category and coercion framework, trac ticket #13412
class sage.rings.multi_power_series_ring_element.MO(x)

Bases: object

Object representing a zero element with given precision.

EXAMPLES:

sage: R.<u,v> = QQ[[]]
sage: m = O(u, v)
sage: m^4
0 + O(u, v)^4
sage: m^1
0 + O(u, v)^1

sage: T.<a,b,c> = PowerSeriesRing(ZZ,3)
sage: z = O(a, b, c)
sage: z^1
0 + O(a, b, c)^1
sage: 1 + a + z^1
1 + O(a, b, c)^1

sage: w = 1 + a + O(a, b, c)^2; w
1 + a + O(a, b, c)^2
sage: w^2
1 + 2*a + O(a, b, c)^2
class sage.rings.multi_power_series_ring_element.MPowerSeries(parent, x=0, prec=+Infinity, is_gen=False, check=False)

Bases: sage.rings.power_series_ring_element.PowerSeries

Multivariate power series; these are the elements of Multivariate Power Series Rings.

INPUT

  • parent - A multivariate power series.

  • x - The element (default: 0). This can be another MPowerSeries object, or an element of one of the following:

    • the background univariate power series ring
    • the foreground polynomial ring
    • a ring that coerces to one of the above two
  • prec - the precision (default: infinity)

  • is_gen - is this element one of the generators? (default: False)

  • check - needed by univariate power series class (default: False)

EXAMPLES:

Construct multivariate power series from generators:

sage: S.<s,t> = PowerSeriesRing(ZZ)
sage: f = s + 4*t + 3*s*t
sage: f in S
True
sage: f = f.add_bigoh(4); f
s + 4*t + 3*s*t + O(s, t)^4
sage: g = 1 + s + t - s*t + S.O(5); g
1 + s + t - s*t + O(s, t)^5


sage: T = PowerSeriesRing(GF(3),5,'t'); T
Multivariate Power Series Ring in t0, t1, t2, t3, t4 over Finite
Field of size 3
sage: t = T.gens()
sage: w = t[0] - 2*t[1]*t[3] + 5*t[4]^3 - t[0]^3*t[2]^2; w
t0 + t1*t3 - t4^3 - t0^3*t2^2
sage: w = w.add_bigoh(5); w
t0 + t1*t3 - t4^3 + O(t0, t1, t2, t3, t4)^5
sage: w in T
True

sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6)
sage: w
t0 + t0*t2 - t4^3 - t0^3*t2^2 + O(t0, t1, t2, t3, t4)^6

Get random elements:

sage: S.random_element(4) # random
-2*t + t^2 - 12*s^3 + O(s, t)^4

sage: T.random_element(10) # random
-t1^2*t3^2*t4^2 + t1^5*t3^3*t4 + O(t0, t1, t2, t3, t4)^10

Convert elements from polynomial rings:

sage: R = PolynomialRing(ZZ,5,T.gens())
sage: t = R.gens()
sage: r = -t[2]*t[3] + t[3]^2 + t[4]^2
sage: T(r)  
-t2*t3 + t3^2 + t4^2
sage: r.parent()
Multivariate Polynomial Ring in t0, t1, t2, t3, t4 over Integer Ring
sage: r in T
True
O(prec)

Return a multivariate power series of total precision prec obtained by truncating self at precision prec. This is the same as ‘add_bigoh’.

EXAMPLES:

sage: B.<x,y> = PowerSeriesRing(QQ); B
Multivariate Power Series Ring in x, y over Rational Field
sage: r = 1 - x*y + x^2
sage: r.O(4)
1 + x^2 - x*y + O(x, y)^4
sage: r.O(2)
1 + O(x, y)^2

Note that this does not change self:

sage: r
1 + x^2 - x*y
V(n)

If f = \sum a_{m_0, \ldots, m_k} x_0^{m_0} \cdots x_k^{m_k}, then this function returns \sum a_{m_0, \ldots, m_k} x_0^{n m_0} \cdots x_n^{n m_k}.

The total-degree precision of the output is n times the precision of self.

EXAMPLES:

sage: H = QQ[['x,y,z']]
sage: (x,y,z) = H.gens()
sage: h = -x*y^4*z^7 - 1/4*y*z^12 + 1/2*x^7*y^5*z^2 \
+ 2/3*y^6*z^8 + H.O(15)
sage: h.V(3)
-x^3*y^12*z^21 - 1/4*y^3*z^36 + 1/2*x^21*y^15*z^6 + 2/3*y^18*z^24 + O(x, y, z)^45
add_bigoh(prec)

Return a multivariate power series of total precision prec obtained by truncating self at precision prec. This is the same as ‘O’.

EXAMPLES:

sage: B.<x,y> = PowerSeriesRing(QQ); B
Multivariate Power Series Ring in x, y over Rational Field
sage: r = 1 - x*y + x^2
sage: r.add_bigoh(4)
1 + x^2 - x*y + O(x, y)^4
sage: r.add_bigoh(2)
1 + O(x, y)^2

Note that this does not change self:

sage: r
1 + x^2 - x*y
coefficients()

Return a dict of monomials and coefficients.

EXAMPLES:

sage: R.<s,t> = PowerSeriesRing(ZZ); R
Multivariate Power Series Ring in s, t over Integer Ring
sage: f = 1 + t + s + s*t + R.O(3)
sage: f.coefficients()
{s*t: 1, 1: 1, s: 1, t: 1}
sage: (f^2).coefficients()
{t^2: 1, 1: 1, t: 2, s*t: 4, s^2: 1, s: 2}

sage: g = f^2 + f - 2; g
3*s + 3*t + s^2 + 5*s*t + t^2 + O(s, t)^3
sage: cd = g.coefficients()
sage: g2 = sum(k*v for (k,v) in cd.iteritems()); g2
3*s + 3*t + s^2 + 5*s*t + t^2
sage: g2 == g.truncate()
True
constant_coefficient()

Return constant coefficient of self.

EXAMPLES:

sage: R.<a,b,c> = PowerSeriesRing(ZZ); R
Multivariate Power Series Ring in a, b, c over Integer Ring
sage: f = 3 + a + b - a*b - b*c - a*c + R.O(4)
sage: f.constant_coefficient()
3
sage: f.constant_coefficient().parent()
Integer Ring
degree()

Return degree of underlying polynomial of self.

EXAMPLES:

sage: B.<x,y> = PowerSeriesRing(QQ)
sage: B
Multivariate Power Series Ring in x, y over Rational Field
sage: r = 1 - x*y + x^2
sage: r = r.add_bigoh(4); r
1 + x^2 - x*y + O(x, y)^4
sage: r.degree()
2
derivative(*args)

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

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a^2*b + T.O(5)
sage: f.derivative(a)
1 + 2*a*b + O(a, b)^4
sage: f.derivative(a,2)
2*b + O(a, b)^3
sage: f.derivative(a,a)
2*b + O(a, b)^3
sage: f.derivative([a,a])
2*b + O(a, b)^3
sage: f.derivative(a,5)
0 + O(a, b)^0
sage: f.derivative(a,6)
0 + O(a, b)^0
dict()

Return underlying dictionary with keys the exponents and values the coefficients of this power series.

EXAMPLES:

sage: M = PowerSeriesRing(QQ,4,'t',sparse=True); M
Sparse Multivariate Power Series Ring in t0, t1, t2, t3 over
Rational Field

sage: M.inject_variables()
Defining t0, t1, t2, t3

sage: m = 2/3*t0*t1^15*t3^48             - t0^15*t1^21*t2^28*t3^5             + 1/2*t0^12*t1^29*t2^46*t3^6             - 1/4*t0^39*t1^5*t2^23*t3^30             + M.O(100)
sage: m.dict()
{(1, 15, 0, 48): 2/3, (15, 21, 28, 5): -1, (12, 29, 46, 6): 1/2, (39, 5, 23, 30): -1/4}
egf()

Method from univariate power series not yet implemented

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.egf()
Traceback (most recent call last):
...
NotImplementedError: egf
exp(prec=+Infinity)

Exponentiate the formal power series.

INPUT:

  • prec – Integer or infinity. The degree to truncate the result to.

OUTPUT:

The exponentiated multivariate power series as a new multivaritate power series.

EXAMPLES:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(3)
sage: exp(f)
1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3
sage: f.exp()
1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3
sage: f.exp(prec=2)
1 + a + b + O(a, b)^2
sage: log(exp(f)) - f
0 + O(a, b)^3

If the power series has a constant coefficient c and exp(c) is transcendental, then exp(f) would have to be a power series over the Symbolic Ring. These are not yet implemented and therefore such cases raise an error:

sage: g = 2+f
sage: exp(g)
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 
'Power Series Ring in Tbg over Multivariate Polynomial Ring in a, b 
over Rational Field'

Another workaround for this limitation is to change base ring to one which is closed under exponentiation, such as \RR or \CC

sage: exp(g.change_ring(RDF))
7.38905609... + 7.38905609...*a + 7.38905609...*b + 3.69452804...*a^2 + 
14.7781121...*a*b + 3.69452804...*b^2 + O(a, b)^3

If no precision is specified, the default precision is used:

sage: T.default_prec()
12
sage: exp(a)
1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + 1/120*a^5 + 1/720*a^6 + 1/5040*a^7 + 
1/40320*a^8 + 1/362880*a^9 + 1/3628800*a^10 + 1/39916800*a^11 + O(a, b)^12
sage: a.exp(prec=5)
1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5
sage: exp(a + T.O(5))
1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5

TESTS:

sage: exp(a^2 + T.O(5))
1 + a^2 + 1/2*a^4 + O(a, b)^5
exponents()

Return a list of tuples which hold the exponents of each monomial of self.

EXAMPLES:

sage: H = QQ[['x,y']]
sage: (x,y) = H.gens()
sage: h = -y^2 - x*y^3 - 6/5*y^6 - x^7 + 2*x^5*y^2 + H.O(10)
sage: h
-y^2 - x*y^3 - 6/5*y^6 - x^7 + 2*x^5*y^2 + O(x, y)^10
sage: h.exponents()
[(0, 2), (1, 3), (0, 6), (7, 0), (5, 2)]
is_nilpotent()

Return True if self is nilpotent. This occurs if

  • self has finite precision and positive valuation
  • self is constant and nilpotent in base ring

otherwise, return False.

EXAMPLES:

sage: R.<a,b,c> = PowerSeriesRing(Zmod(8)); R
Multivariate Power Series Ring in a, b, c over Ring of integers
modulo 8
sage: f = a + b + c + a^2*c
sage: f.is_nilpotent()
False
sage: f = f.O(4); f
a + b + c + a^2*c + O(a, b, c)^4
sage: f.is_nilpotent()
True

sage: g = R(2)
sage: g.is_nilpotent()
True
sage: (g.O(4)).is_nilpotent()
True

sage: S = R.change_ring(QQ)
sage: S(g).is_nilpotent()
False
sage: S(g.O(4)).is_nilpotent()
False
is_square()

Method from univariate power series not yet implemented

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.is_square()
Traceback (most recent call last):
...
NotImplementedError: is_square
is_unit()

A multivariate power series is a unit if and only if its constant coefficient is a unit.

EXAMPLES:

sage: R.<a,b> = PowerSeriesRing(ZZ); R
Multivariate Power Series Ring in a, b over Integer Ring
sage: f = 2 + a^2 + a*b + a^3 + R.O(9)
sage: f.is_unit()
False
sage: f.base_extend(QQ).is_unit()
True
laurent_series()

Not implemented for multivariate power series.

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.laurent_series()
Traceback (most recent call last):
...
NotImplementedError: laurent_series not defined for multivariate power series.
list()

Doesn’t make sense for multivariate power series. Multivariate polynomials don’t have list of coefficients either.

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.list()
Traceback (most recent call last):
...
NotImplementedError: Multivariate power series do not have list
of coefficients; use 'coefficients' to get a dict of coefficients.
log(prec=+Infinity)

Return the logarithm of the formal power series.

INPUT:

  • prec – Integer or infinity. The degree to truncate the result to.

OUTPUT:

The logarithm of the multivariate power series as a new multivaritate power series.

EXAMPLES:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = 1 + a + b + a*b + T.O(5)
sage: f.log()
a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5
sage: log(f)
a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5
sage: exp(log(f)) - f
0 + O(a, b)^5

If the power series has a constant coefficient c and exp(c) is transcendental, then exp(f) would have to be a power series over the Symbolic Ring. These are not yet implemented and therefore such cases raise an error:

sage: g = 2+f
sage: log(g)
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '-': 'Symbolic Ring' and 'Power 
Series Ring in Tbg over Multivariate Polynomial Ring in a, b over Rational Field'

Another workaround for this limitation is to change base ring to one which is closed under exponentiation, such as \RR or \CC

sage: log(g.change_ring(RDF))
1.09861228... + 0.333333333...*a + 0.333333333...*b - 0.0555555555...*a^2
+ 0.222222222...*a*b - 0.0555555555...*b^2 + 0.0123456790...*a^3
- 0.0740740740...*a^2*b - 0.0740740740...*a*b^2 + 0.0123456790...*b^3 
- 0.00308641975...*a^4 + 0.0246913580...*a^3*b + 0.0246913580...*a*b^3 
- 0.00308641975...*b^4 + O(a, b)^5

TESTS:

sage: (1+a).log(prec=10).exp()
1 + a + O(a, b)^10
sage: a.exp(prec=10).log()
a + O(a, b)^10

sage: log(1+a)
a - 1/2*a^2 + 1/3*a^3 - 1/4*a^4 + 1/5*a^5 - 1/6*a^6 + 1/7*a^7 
- 1/8*a^8 + 1/9*a^9 - 1/10*a^10 + 1/11*a^11 + O(a, b)^12
sage: -log(1-a+T.O(5))
a + 1/2*a^2 + 1/3*a^3 + 1/4*a^4 + O(a, b)^5
sage: a.log(prec=10)
Traceback (most recent call last):
...
ValueError: Can only take formal power series for non-zero constant term.
monomials()

Return a list of monomials of self. These are the keys of the dict returned by ‘coefficients’.

EXAMPLES:

sage: R.<a,b,c> = PowerSeriesRing(ZZ); R
Multivariate Power Series Ring in a, b, c over Integer Ring
sage: f = 1 + a + b - a*b - b*c - a*c + R.O(4)
sage: f.monomials()
[1, b*c, b, a, a*c, a*b]
sage: f = 1 + 2*a + 7*b - 2*a*b - 4*b*c - 13*a*c + R.O(4)
sage: f.monomials()
[1, b*c, b, a, a*c, a*b]
sage: f = R.zero()
sage: f.monomials()
[]
ogf()

Method from univariate power series not yet implemented

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.ogf()
Traceback (most recent call last):
...
NotImplementedError: ogf
padded_list()

Method from univariate power series not yet implemented

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.padded_list()
Traceback (most recent call last):
...
NotImplementedError: padded_list
polynomial()

Return underlying polynomial of self as an element of underlying multivariate polynomial ring.

EXAMPLES:

sage: M = PowerSeriesRing(QQ,4,'t'); M
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational
Field
sage: t = M.gens()
sage: f = 1/2*t[0]^3*t[1]^3*t[2]^2 + 2/3*t[0]*t[2]^6*t[3]             - t[0]^3*t[1]^3*t[3]^3 - 1/4*t[0]*t[1]*t[2]^7 + M.O(10)
sage: f  
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
- 1/4*t0*t1*t2^7 + O(t0, t1, t2, t3)^10

sage: f.polynomial()
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
- 1/4*t0*t1*t2^7

sage: f.polynomial().parent()
Multivariate Polynomial Ring in t0, t1, t2, t3 over Rational Field

Contrast with truncate:

sage: f.truncate()
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3 - 1/4*t0*t1*t2^7
sage: f.truncate().parent()
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational Field
prec()

Return precision of self.

EXAMPLES:

sage: R.<a,b,c> = PowerSeriesRing(ZZ); R
Multivariate Power Series Ring in a, b, c over Integer Ring
sage: f = 3 + a + b - a*b - b*c - a*c + R.O(4)
sage: f.prec()
4
sage: f.truncate().prec()
+Infinity
shift(n)

Doesn’t make sense for multivariate power series.

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.shift(3)
Traceback (most recent call last):
...
NotImplementedError: shift not defined for multivariate power series.
solve_linear_de(prec=+Infinity, b=None, f0=None)

Not implemented for multivariate power series.

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.solve_linear_de()
Traceback (most recent call last):
...
NotImplementedError: solve_linear_de not defined for multivariate power series.
sqrt()

Method from univariate power series not yet implemented (An alias for square_root.)

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.sqrt()
Traceback (most recent call last):
...
NotImplementedError: square_root
square_root()

Method from univariate power series not yet implemented. Depends on square root method for multivariate polynomials.

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.square_root()
Traceback (most recent call last):
...
NotImplementedError: square_root
truncate(prec=+Infinity)

Return infinite precision multivariate power series formed by truncating self at precision prec.

EXAMPLES:

sage: M = PowerSeriesRing(QQ,4,'t'); M
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational Field
sage: t = M.gens()
sage: f = 1/2*t[0]^3*t[1]^3*t[2]^2 + 2/3*t[0]*t[2]^6*t[3]             - t[0]^3*t[1]^3*t[3]^3 - 1/4*t[0]*t[1]*t[2]^7 + M.O(10)
sage: f  
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
- 1/4*t0*t1*t2^7 + O(t0, t1, t2, t3)^10

sage: f.truncate()  
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
- 1/4*t0*t1*t2^7
sage: f.truncate().parent()
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational Field

Contrast with polynomial:

sage: f.polynomial()  
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3 - 1/4*t0*t1*t2^7
sage: f.polynomial().parent()
Multivariate Polynomial Ring in t0, t1, t2, t3 over Rational Field
valuation()

Return valuation of self.

EXAMPLES:

sage: R.<a,b> = PowerSeriesRing(GF(4949717)); R
Multivariate Power Series Ring in a, b over Finite Field of
size 4949717
sage: f = a^2 + a*b + a^3 + R.O(9)
sage: f.valuation()
2
sage: g = 1 + a + a^3
sage: g.valuation()
0
valuation_zero_part()

Doesn’t make sense for multivariate power series; valuation zero with respect to which variable?

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.valuation_zero_part()
Traceback (most recent call last):
...
NotImplementedError: valuation_zero_part not defined for multivariate
power series; perhaps 'constant_coefficient' is what you want.
variable()

Doesn’t make sense for multivariate power series.

TESTS:

sage: T.<a,b> = PowerSeriesRing(ZZ,2)
sage: f = a + b + a*b + T.O(5)
sage: f.variable()
Traceback (most recent call last):
...
NotImplementedError: variable not defined for multivariate power
series; use 'variables' instead.
variables()

Return tuple of variables occuring in self.

EXAMPLES:

sage: T = PowerSeriesRing(GF(3),5,'t'); T
Multivariate Power Series Ring in t0, t1, t2, t3, t4 over
Finite Field of size 3
sage: t = T.gens()
sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6)
sage: w
t0 + t0*t2 - t4^3 - t0^3*t2^2 + O(t0, t1, t2, t3, t4)^6
sage: w.variables()
(t0, t2, t4)
sage.rings.multi_power_series_ring_element.is_MPowerSeries(f)
Return true if input is a multivariate power series.

TESTS:

sage: from sage.rings.power_series_ring_element import is_PowerSeries
sage: from sage.rings.multi_power_series_ring_element import is_MPowerSeries
sage: M = PowerSeriesRing(ZZ,4,'v');
sage: is_PowerSeries(M.random_element(10))
True
sage: is_MPowerSeries(M.random_element(10))
True
sage: T.<v> = PowerSeriesRing(RR)
sage: is_MPowerSeries(1 - v + v^2 +O(v^3))
False
sage: is_PowerSeries(1 - v + v^2 +O(v^3))
True

Previous topic

Multivariate Power Series Rings

Next topic

Laurent Series Rings

This Page