Demo for PolynomSeries package

SetDirectory["NormalForm"];

<< PolynomSeries`

Package PolynomSeries contains tools for dealing with multivariate polynomial series. Surprisingly, Mathematica lacks tools for working with polynomial series and the present package is intended to fill this gap. Below is a brief description of the functionalities of the package. Let us generate a simple polynomial with respect to one variable x1:

p = Plus@@Flatten[Table[1 + x1^i,  {i,  0,  5}]]

To transform this polynomial into the series use the following:

R  =  Polynom2Series[p,  {x1}]

The above list, R,  is the main object of the package. Each element of R consists of two entries: the first one is the power α =α1 + α2... αn of the term x1^α1 x2^α2} ... xn^αn, which is itself thesecond entry. Here xj are the elements in the second input parameter of the function. Consider an example of multivariate series. Create first a polynomial by

p1 = 
      Plus@@Flatten[
          Table[y1^i*y2^j*y3^k,  {i,  0,  1},  {j,  1,  2}, 
             {k,  1,  2}]]

Transforming the polynomial into a series with respect to y1, y2, y3 yields:

R1  =  Polynom2Series[p1,  {y1,  y2,  y3}]

One can consider a transformation of the polynomial into series with respect to some (not all) variables (y2, y3$below):

Polynom2Series[p1,  {y1,  y3}]

To transform series back to the polynomial use the command Series2Polynom[ ] (and check whether the result is the same as the original polynomial)

\(p2\  = \ Series2Polynom[R1]; 
p2 === p1\)

Several arithmetic operations on series of type R are defined in the package. To add two series use AddR[R1, R2] command:

R2  =  AddR[R,  R1]

Multiplying two series and retaining terms up to index 3:

MultRR[R,  R1,  3]

If, however, we want to know only terms of index 4 use MultRRLayer[ ] command:

MultRRLayer[R,  R1,  4]

Series can also be multiplied by a constant:

MultRC[R,  2]

or taken with an opposite sign

NegR[R]

The commands defined in the package return series already ordered by their indices. This is done by OrderR[ ] command which can also be accessed by the user to order series obtained by other means. For example, begin lists two series can be joined in which case they will have to be ordered:

R2  =  Join[R,  R1]

OrderR[R2]

It is often in the applications that one needs to substitute a new  series for some (or all) variables in the given series.  This can be done using SubstR[R, RV, xvar, yvar, n] command.  Here RV is a vector of series with respect to new variables yvar which are substituted into R which is in turn a series with respect to variables xvar.  To substitite a simple series $(1+z1, 2+z2, 3+z3)$ to every  (y1, y2, y3) in the series R1, first generate a vector of series substitions:

subst  =  {1 + z1,  2 + z2,  3 + z3};

RVy  =  
      MapThread[Polynom2Series[#1,  #2]&, 
         {subst,  {{z1},  {z2},  {z3}}}]

Function2Series[Sin[z],  z,  R,  x,  3]

Rxy  =  
      SubstR[R1,  RVy,  {y1,  y2,  y3},  {z1,  z2,  z3},  3]

Note that we only retain terms up to index 3. If, user is interested only in terms of index, say, 4, SubstRLayer[ ]  is to be used:

Rxy  =  
      SubstRLayer[R1,  RVy,  {y1,  y2,  y3},  {z1,  z2,  z3},  4]

The package also has tools for applying functions to series. The function is first expanded in the power series in the neighbourhood of
a point x_0 (0 default), and the series R$is then substituted into the function series. If the function is not singular in zero, it can safely be applied to any series:

Function2Series[Sin[z],  z,  R,  x1 , 3]

There are separate commands for two commonly used functions which are singular in zero: it is square root of series and inverse function. The correct usage of this commands can only be guarantereed if the series contain constant term (i.e. term with index 0). To find square root with terms up to index 4 use

SqrtR[R,  3]

Inverse series (1/R) is found by

InverseR[R,  3]

Package also contains functions for deleting zero (empty) elements (DeleteZero[R]),  for cutting down series retaining terms with index
less or equal to n (CutR[R, n]), simplifying terms in the series (SimplifyR[R, var]), generating simple series of the form {{α, k x^α}} by GenR[x, α, k].

CutR[R1,  2]

DeleteZeroR[R1]