Maple packages: powseries

[Up] [Previous] [Next]


The powseries package is an implementation of the objects in, and operations over, the (unitary) ring of formal power series. This is actually a subset of the full algebraic notion due to certain restrictions:

The primary resulting limitation to remember is that you can neither create power series with multivariate monomials, nor create the isomorphic equivalent which is a formal power series with a coefficient ring that is itself based on a (different) ring of formal power series. In other words, there is no way with powseries to create (for example) the formal power series equivalent of the 2-variable polynomial x*y. If you do need such a capability, it is possible to implement the second (isomorphic) approach with the Gauss package, in particular by making use of the UnivariatePowerSeries category. Similarly, since powseries is effectively limited to using a commutative coefficient ring, to create a non-commutative ring of formal power series you would also need to make use of Gauss.

Getting Started

Starting from the Maple prompt (>) the command:

> with(powseries);

will prepare you to use all the routines contained in the powseries package. Online help information for this package is available with the command:

> ?powseries

For each of the powseries routines, detailed online help is available with the command (using add as an example):

> ?powseries,add

Summary

The routines in powseries represent formal power series as a particular kind of Maple proc that is created by powcreate, and not as a series datatype. If X is such an object, then X(1) would return the value of the coefficient for the monomial term x^1, and X(2) would return the coefficient for the monomial term x^2, etc. It is not the case that X(n) for a variable argument named n will return a general algebraic expression for an arbitrary coefficient. It will simply be returned unevaluated.

add - add one or more formal power series.
Example: result := add(F1, F2, F3, F4):

compose - compose two formal power series.
Example: result := compose(F1,F2):
This works if and only if F2(0)=0. Algebraically speaking, the composition is also supposed to exist when F2(0)<>0 and F1 is a polynomial, but the powseries routines have no way to distinguish when a formal power series is only a polynomial. In such situations, you should instead use evalpow with a polynomial expression in F2.

evalpow - evaluate an arithmetic expression in formal power series.
Example: result := evalpow(3*F1^2+inverse(F2)):

inverse - form the multiplicative inverse (ie: reciprocal) formal power series.
Example: result := inverse(F):
This works if and only if F(0)<>0.

multconst - multiply a formal power series by a constant.
Example: result := multconst(F, 17):

multiply - multiply two formal power series.
Example: result := multiply(F1,F2):

negative - negate a formal power series.
Example: result := negative(F):
This is faster but otherwise has the same effect as multconst(F,-1).

powcreate - create a formal power series.
Example: powcreate(F(i)=i!,F(0)=0):
The argument F should be an unassigned variable name, which powcreate will use as the name for the proc that it creates. Remember that in some circumstances you may need to delay evaluation of the right-hand side of the recurrence equation. You will need to experiment to find the best way to do this for your particular situation, but remember that right quotes (') can come in handy.

powdiff - take the derivative of a formal power series.
Example: result := powdiff(F):
Perform the natural term-by-term differentiation with respect to the variable that the power series is based on.

powexp - form the exponential of a formal power series.
Example: result := powexp(F):
This generates the formal power series corresponding to the composition exp(F).

powint - take the integral of a formal power series.
Example: result := powint(F):
Perform the natural term-by-term integration with respect to the variable that the power series is based on.

powlog - form the logarithm of a formal power series.
Example: result := powlog(F):
This generates the formal power series corresponding to the composition log(1-F), which is well defined if and only if F(0)<>0.

powpoly - convert a single-variable polynomial into a formal power series.
Example: result := powpoly(a*x^2+1,x):
This takes the polynomial in x and returns the corresponding formal power series such that result(0)=1, result(2)=a, and all other coefficients are 0.

powsolve - formal power series solution to a system of linear differential equations.
Example: result := powsolve(diff(f(x),x)=f(x),f(0)=0):
The function argument f in this case is an unassigned name, and not formal power series. It is important to remember that the resulting power series solution is only a formal solution to the system, and not necessarily valid as an analytic solution. For instance, as an ODE the Riccati equation has a formal power series solution which is of no use in an analytic context.

quotient - perform division of formal power series.
Example: result := quotient(F1,F2):
This is faster but otherwise has the same effect as multiply(F1,inverse(F2)). As a result, the quotient is defined if and only if F2(0)<>0.

reversion - perform reversion of formal power series.
Example: result := reversion(F1,F2):
The relationship of the reversion process to the composition operation is analogous to the relationship of the division process to the multiplication operation. In other words, just as inverse forms the multiplicative inverse of a formal power series, reversion can be used (amongst other things) to find the compositional inverse of a formal power series. Reversion is well defined only when F1(0)=0, F1(1)=1, and F2(0)=0. The solution has the property that compose(F1,result)=F2.

subtract - subtract one formal power series from another.
Example: result := subtract(F1,F2):
This is faster but otherwise has the same effect as add(F1,negative(F2)).

tpsform - convert a formal power series into a truncated series.
Example: result := tpsform(F,x,3):
This returns a series data structure with the specified variable name and containing the specified number of initial terms from the original formal power series.

Example

> # Let's get started.
  with(powseries):

> # Define F to be the Maclaurin series for sin(x).
  powcreate(F(i)=(D@@i)(sin)(0)/i!);

> # Examine the coefficients for the terms x^0, ... x^8.
  F(i)$i=0..8;

        0  1  0  -1/6  0  1/120  0  -1/5040  0

> # Find the compositional inverse of F,
  # ie: find G such that F(G(x))=x.
  X := powpoly(x,x):
  G := reversion(F,X):

> # Now check to see that G is the compositional inverse.
  # The order term O(x^6) indicates the point at which the
  # formal power series was truncated.
  tpsform(compose(F,G),x);

        x+O(x^6)

> # Similarly:
  tpsform(compose(G,F),x);

        x+O(x^6)

> # Note that we could have created F using 'diff' and
  # 'subs' but it is trickier because we must delay the
  # substitution of x=0 until after the n-th order
  # derivative is actually taken, and we also have to
  # handle the F(0) case separately since diff(f(x),x$0)
  # isn't a valid use of the 'diff' command.  In the
  # case above we didn't run into this problem;
  # (D@@0) worked because it is the identity operator.
  F := 'F':
  powcreate(F(i)='subs'(x=0,diff(sin(x),x$i)/i!),F(0)=0);

> # Some power series don't have a reciprocal.
  inverse(X);

Error, (in powseries/inverse) inverse will have pole at zero

> # Similarly, some don't have a compositional inverse.
  reversion(F,X);

Error, (in powseries/reversion) F, 
does not have necessary coeffs. in constant and 1st order terms

> # This is how you compose a formal power series
  # with a polynomial.
  powcreate(C(i)=(D@@i)(cos)(0)/i!);
  result := eval(subs(x=C,'evalpow'(7*x^2+1))):

> # It couldn't have been done if 7*x^2+1 was converted
  # to a formal power series:
  P := powpoly(7*x^2+1,x):
  compose(P,C);

Error, (in powseries/compose) C, must have coefficient of x^0 = zero

Related Features

Literature References


HTML originally written by Reid M. Pinchback
Copyright 1996, Massachusetts Institute of Technology
Last modified: 96/06/11 (reidmp@mit.edu)

[Up] [Previous] [Next]