M-GSET chapter=4M-HM-GSET section=2M-HM-GSET name=Poisson Series FunctionsM-HM-
Ginclude chapter-headM-H
Special efficient representations have been vital for success in certain types o
f computations. Calculations in the field of Celestial Mechanics have used a re
presentation known as the Poisson series. The space and time efficiency of Pois
son series can be helpful in a variety of other domains where the calculations i
nvolve the approximate solution of differential equations similar to those descr
ibing the perturbed motion of planets.
A Poisson series is a finite sum: Spi trig(qi ) where "trig" is either sin or c
os. and pi is some non-trigonometric expression. The argument qi of the typical
trigonometric function has a specific form described below which is sufficiently
general to support a useful calculus of operations and which allows the compute
r to maintain an efficient canonical simplified form for all results. The pi can
be represented as general macsyma expressions, or, for special problems, they c
an be encoded more efficiently, as described near the end of this section.
The argument qi is a sum of integer multiples of a fixed, pre-determined set of
angle-variables. The default is the set of 6 identifiers: {u v,w x,y,z}. This s
et may be changed by assigning an alternative list of identifiers to the macsyma
symbol poisvars. For example poisvars:[r,s,t]$ establishes the set of angle va
riables {r,s,t}. In general, these angle variables must not occur in the coeffic
ients, pi .
In order to provide for an efficient representation, you must have an a priori b
ound on the magnitude of the numerical coefficients in the qi during the comput
ation. In general this is not a great problem since the frequencies of the trig
onometric terms of interest can be anticipated. All these coefficients will be
packaged into a fixed-length vector, an integer, for efficient processing. What
this means to the user is that if cos(auu+avv+...+azz) occurs, then |ak| must n
ot exceed a pre-agreed-upon limit. The macsyma variable poislim controls this li
mit. It has a default value of 5 (providing 5 bits of information or a coeffici
ent range of -15 to 15) if there are the default 6 angle variables in use. That
is, in the default case, sin(15*x) can be represented, but sin(17*x)cannot. Or
dinarily, the number of variables in poisvars times poislim should be kept unde
r 30 if computation time and space is of concern. If fewer variables are used in
poisvars, then poislim will be set higher, since all bit fields of from 10 to 3
0 bits are equally (in)expensive.
intopois(e) returns the Poisson series form of a general macsyma expression e. S
ince it is not necessarily apparent to you that an expression or a part of it is
in Poisson form, the display program uses the notation /P/ just to the right of
the line label in displaying such a result.
poissimp(e) returns a general macsyma expression equivalent to the expression
e , but which has been transformed into a Poisson series and then back. In gene
ral it will have the effect of transforming the expression into a sum of trigono
metric terms. The expression e may be in macsyma's general representation, or
it may be an expres^_sion which has Poisson series components. For example, e
might be a product of two previously computed Poisson series, g*h, or a sum g+h,
or an integer power of a series g^n, etc. This function is in effect a fast ca
nonical simplification algorithm, and also can be used to change a Poisson serie
s into general macsyma form.
printpois(p) prints a (potentially very long) Poisson series in a readable forma
t. In common with poissimp, it will convert p into a Poisson encoding first if
necessary. It returns the value done.
poistrim is a reserved function name. If you define a function of this name, it
gets applied during Poisson multiplication. Poistrim is a function of n argum
ents where n is the length of the poisvars list (default 6). These arguments ar
e the coefficients of the variables on poisvars in a term. Terms for which pois
trim returns true are eliminated during multiplication. This function can be use
d to retain only those terms whose angular frequency is of interest. This is ill
ustrated in the example below.
diff(a,b) returns the derivative of the Poisson series a with respect to the in
determinate b. B must occur only in the trigonometric arguments (i.e. is on the
list poisvars) or only in the coefficients. Note that the usual diff command is
used, and that this specialized efficient differentiation takes place only if t
he first argument is a Poisson series.
integrate(a,b) returns the integral of the Poisson series a with respect to b.
The variable of integration must appear only in the trigonometric arguments (i.e
. is on the list poisvars) or only in the coefficients, not in both. Note that t
he usual integrate command is used, and that this specialized efficient integrat
ion takes place only if the first argument is a Poisson series.
poissubst(a,b,c) returns a Poisson series which substitutes a for b in the Poiss
on series c. Two cases are considered . (1) Where b is in poisvars, say x, the
n a must be an expression linear in poisvars variables (e.g.6*u+4*v). (2) Where
b is other than those variables, then a must also be free of those variables, a
nd furthermore, free of sines or cosines.
poissubst(a,b,c,d,n) is a special type of substitution. It computes the expans
ion of substituting a+d for b in the Poisson series c. The idea is that d is a
small parameter, not a Poisson variable. Poissubst expands cos(d) and sin(d) to
order n so as to provide a result in the right form. This functionality is ver
y useful in certain calculations, although rather mysterious if you have no use
for it. It is illustrated in the example below.
poismap(series,sinfn,cosfn)will map the function sinfn on the sine terms and cos
fn on the cosine terms of the Poisson series given, and return a new Poisson ser
ies with the transformed terms. sinfn and cosfn are functions of two arguments
which are a coefficient and a trigonometric part of a term in series respectivel
y. If a term in the series is a*sin(3*x+4*y), then the value of sinfn(a,3*x+4*
y) will be the coefficient of sin(3*x+4*y) in the answer. If we define f(p,q):=
ratsimp(p), then poismap(s,f,f) would return a new series equivalent to s, but
where each coefficient is rationally simplified.
This example illustrates many of the Poisson series facilities.
(c1) trial:a*cos(x+2*y)-a*sin(u-4*x);
(d1) a cos(2 y + x) + a sin(4 x - u)
(c2) intopois(trial^2);
rat/pois2.o being loaded.
[fasl rat/pois2.o]
Maximum poisson coefficient is +-15
for each of the variables in [u, v, w, x, y, z]
2
a cos(4 y + 2 x) 2 2
(d2)/P/ ----------------- + a sin(2 y + 5 x - u) - a sin(2 y - 3 x + u)
2
2
a cos(8 x - 2 u) 2
- ----------------- + a
2
(c3) integrate(trial,y);
a sin(2 y + x)
(d3)/P/ --------------
2
(c4) printpois(sin(x)^5);
5/8 sin(x)
- 5/16 sin(3 x)
1/16 sin(5 x)
(d4) done
(c5) /* poistrim is called with 6 arguments (the coefs of u ... z)
and mapped over the terms during multiplication. This
definition serves to discard terms when x's coefficient exceeds 3.*/
poistrim(uc,vc,wc,xc,yc,zc):= is(xc>3) $
(c6) intopois(sin(x)^5);
5 sin(x) sin(3 x)
(d6)/P/ -------- - --------
8 4
(c7) /* This command substitutes u+e for v in the Poisson Series
cos(v). The indeterminate e is not permitted in the argument
of a trignometric form, so cos(u+e) is expanded as
cos(e) cos(u) - sin(e) sin(u), and then the cos(e) and sin(e)
terms are re-expressed as Taylor series, as shown below.*/
(powerdisp:true, /*display power series in right order*/
poissubst(u,v,cos(v),e,3));
2 3
e e
(d7)/P/ (1 - --) cos(u) + (- e + --) sin(u)
2 6
Remember that coefficients in the arguments of the trigonometric functions fit
in a pre-arranged domain. If you change this domain by changing either poisvars
or poislim, all pre-existing Poisson series will be invalid.
If you are particularly concerned with efficiency, it is possible to define the
Poisson series coefficient arithmetic to be something other than normal MACSYM
A general form. You must define the programs needed to add, multiply, substitut
e, differen^_tiate, encode and decode the coefficients. You must also supply th
e encoding for constant expressions which represent +1 and -1 and a program to t
est for 0 (zero). Packages which may be useful include those where coef^_ficien
ts are in CRE form, poly^_nomials with floating point coefficients, or polynomia
ls with rational number coefficients. A model for these is given in the lisp so
urce file "rat/pois2.l" which defines the whole Poisson series system and treats
coefficents as the default general macsyma form. The ambitious programmer might
look at the alternatives of using CRE form provided in the files "rat/ratpoi.l
" and "rat/nratpoi.l."
For further information on the techniques used in macsyma for Poisson series c
alculations see "On the Multiplication of Poisson Series," by R. Fateman, Celest
ial Mechanics, v. 10, no 2, (Oct. 1974), pages 243-247.
This section M-) 1986, Richard Fateman. Used by permission. ^L