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:
`+`
, `*`
, and 1
can be viewed
as forming a (commutative) unitary ring. The caution we must note is that
for complicated expressions the default level of simplification in
Maple may not be sufficient to notice when, for example, the expression
for given coefficient is equal to zero. In practice this would tend to
be an usual situation to run into when using this particular package, but
it should be kept in mind.
powseries
is commutative.
powcreate
).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
.
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
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.result := add(F1, F2, F3, F4):
compose
- compose two formal power series.result := compose(F1,F2):
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.result := evalpow(3*F1^2+inverse(F2)):
inverse
- form the multiplicative inverse (ie: reciprocal)
formal power series.result := inverse(F):
F(0)<>0
.
multconst
- multiply a formal power series by a constant.result := multconst(F, 17):
multiply
- multiply two formal power series.result := multiply(F1,F2):
negative
- negate a formal power series.result := negative(F):
multconst(F,-1)
.
powcreate
- create a formal power series.powcreate(F(i)=i!,F(0)=0):
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.result := powdiff(F):
powexp
- form the exponential of a
formal power series.result := powexp(F):
exp(F)
.
powint
- take the integral of a
formal power series.result := powint(F):
powlog
- form the logarithm of a formal power series.result := powlog(F):
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.result := powpoly(a*x^2+1,x):
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.result := powsolve(diff(f(x),x)=f(x),f(0)=0):
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.result := quotient(F1,F2):
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.result := reversion(F1,F2):
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.result := subtract(F1,F2):
add(F1,negative(F2))
.
tpsform
- convert a formal power series into a
truncated series.result := tpsform(F,x,3):
series
data structure with the specified
variable name and containing the specified number of initial terms
from the original formal power series.> # 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
series
and taylor
.
Gauss
package contains the
UnivariatePowerSeries
category and the
LazyUnivariatePowerSeries
domain for
representing formal power series.
calculus
portion of the Maple share library,
in particular FPS
, gdev
, and gfun
.
powseries
routines to the solution of ordinary differential equations.
powseries
package and a
section on its application to the solution of ordinary differential
equations.