Introduction to the Mgfun package, a package for Multivariate Generating FUnctions.

The Mgfun package is used to perform calculations on multivariate functions and sequences. In particular, it is well suited for calculations on so-called special functions, including hypergeometric functions and sequences, their q-analogues and holonomic functions. In the philosophy of Mgfun, these functions and sequences are described by systems of linear homogeneous differential or difference equations, or by q-analogues of them. A natural tool that plays a central role in these calculations is a suitable generalization of Groebner bases.

When using the Mgfun package, any function or sequence is represented by a set of linear homogeneous equations it satisfies. When such systems are known for functions f(x,y) and g(x,y), Mgfun can compute a system for the sum f(x,y)+g(x,y), the product f(x,y)g(x,y) or definite integrals of f(x,y) with respect to y. In the case of sequences u[n,m] and v[n,m], it can compute equations for the sum u[n,m]+v[n,m], the product u[n,m]v[n,m] or definite summations of u[n,m] over all m. Mgfun can also deal with mixed cases, such as f[n,m](x,y), or with other types of linear equations the user might want to define.

Using these basic operations, one can:

- find closed forms (in terms of hypergeometric functions and sequences and their
q-analogues);

- compute (ordinary, exponential, Bessel...) generating functions,

- extract coefficients of a series (for any orthogonal basis of the algebra of series in a
general class);

- check identities and prove new ones;

- compute diagonals of series.

This worksheet gives an overview of Mgfun through some applications.

Once you have installed Mgfun, the following call should run with no error.

The Legendre polynomials.

As mentioned above, definite summations can be computed using the Mgfun package. As an example, we show how to calculate equations that describe the Legendre polynomials P[n](x). The n-th polynomial of this sequence is defined as the sum for all k of binomial(n,k)^2*(x-1)^k*(x+1)^(n-k)*2^(-n). Let us now compute this sum.

We first declare an algebra of operators to enter equations that describe the summand. We need differential equations with respect to x and recurrence equations with respect to n and k. It will also be possible to enter mixed differential-recurrence equations.

A particular use of summation is to compute generating function. As an example, we give here the generating function of Legendre polynomials. Recall that it is defined as phi(x,y)=sum(P[n](x)y^n,n=0..infinity).

We follow the same method as above, beginning by declaring another algebra and another term order well-suited for elimination of the index of summation n.

Computing integrals using Mgfun is very similar to computing sums. As an example, we prove that Legendre polynomials form an orthogonal family for the scalar product <f(x),g(x)>=int(f(x)g(x),x=-1..1).

We prove this by integration of the bivariate generating function h of the products J[n](x)J[m](x) between -1 and +1, so as to find the generating function of the scalar products <J[n](x),J[m](x)>. So we first declare another algebra and define h.

Generally, this difference has to be holonomic (i.e., it is always possible to get equations that describe it using the theory of holonomy). In the present case, it is a polynomial. We thus get simple linear operators that cancel on them.

Therefore, it is the same when we apply them to the left-hand side. Composition of operators translates into product.

A particular case of calculation of integrals is taking the coefficients of a series by Cauchy's formula. We exemplify it by computing again the squares of the modules ||P[n](x)||^2=<P[n](x),P[n](x)> in this more direct way.

We first divide the generating function GF of the squares of the modules by x^(n+1).