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 of computations. Calculations in the field of Celestial Mechanics have used a representation known as the Poisson series. The space and time efficiency of Poisson series can be helpful in a variety of other domains where the calculations involve the approximate solution of differential equations similar to those describing the perturbed motion of planets. A Poisson series is a finite sum: Spi trig(qi ) where "trig" is either sin or cos. 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 computer to maintain an efficient canonical simplified form for all results. The pi can be represented as general macsyma expressions, or, for special problems, they can 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 set 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 variables {r,s,t}. In general, these angle variables must not occur in the coefficients, pi . In order to provide for an efficient representation, you must have an a priori bound on the magnitude of the numerical coefficients in the qi during the computation. In general this is not a great problem since the frequencies of the trigonometric 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 not exceed a pre-agreed-upon limit. The macsyma variable poislim controls this limit. It has a default value of 5 (providing 5 bits of information or a coefficient 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. Ordinarily, the number of variables in poisvars times poislim should be kept under 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 30 bits are equally (in)expensive. intopois(e) returns the Poisson series form of a general macsyma expression e. Since 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 general it will have the effect of transforming the expression into a sum of trigonometric 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 canonical simplification algorithm, and also can be used to change a Poisson series into general macsyma form. printpois(p) prints a (potentially very long) Poisson series in a readable format. 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 arguments where n is the length of the poisvars list (default 6). These arguments are the coefficients of the variables on poisvars in a term. Terms for which poistrim returns true are eliminated during multiplication. This function can be used to retain only those terms whose angular frequency is of interest. This is illustrated in the example below. diff(a,b) returns the derivative of the Poisson series a with respect to the indeterminate 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 the 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 the usual integrate command is used, and that this specialized efficient integration 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 Poisson series c. Two cases are considered . (1) Where b is in poisvars, say x, then 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, and furthermore, free of sines or cosines. poissubst(a,b,c,d,n) is a special type of substitution. It computes the expansion 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 very 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 cosfn on the cosine terms of the Poisson series given, and return a new Poisson series 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 respectively. 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 MACSYMA general form. You must define the programs needed to add, multiply, substitute, differen^_tiate, encode and decode the coefficients. You must also supply the encoding for constant expressions which represent +1 and -1 and a program to test for 0 (zero). Packages which may be useful include those where coef^_ficients are in CRE form, poly^_nomials with floating point coefficients, or polynomials with rational number coefficients. A model for these is given in the lisp source 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 calculations see "On the Multiplication of Poisson Series," by R. Fateman, Celestial Mechanics, v. 10, no 2, (Oct. 1974), pages 243-247. This section M-) 1986, Richard Fateman. Used by permission. ^L