### Full Text - Electronic Transactions on Numerical Analysis

```ETNA
Electronic Transactions on Numerical Analysis.
Volume 9, 1999, pp. 77-101.
Copyright  1999, Kent State University.
ISSN 1068-9613.
Kent State University
etna@mcs.kent.edu
SOFTWARE FOR THE ALGORITHMIC WORK WITH ORTHOGONAL
POLYNOMIALS AND SPECIAL FUNCTIONS∗
WOLFRAM KOEPF†
Abstract. This article was presented as a Plenary Talk at the IWOP 98, Madrid. An introduction to general
purpose computer algebra systems is given, and the possibilities to use computer algebra in the work with orthogonal
polynomials and special functions are discussed in detail.
Key words. orthogonal polynomials, special functions, computer algebra, Maple V, holonomic functions,
differential equations, recurrence equations, hypergeometric functions, Zeilberger’s algorithm, Gosper’s algorithm,
Petkovšek’s algorithm.
AMS subject classifications. 33-02, 33C45, 11B37, 34A30, 33C20, 68Q40.
1. Basics. Modern computer algebra systems use heuristics and algorithms for the fast
computation with mathematical formulas. For instance, general purpose computer algebra
systems like Axiom [14], Derive [22], Macsyma [19], Maple [6], Mathematica [25] or Reduce [13] handle integrals surprisingly well. Even a small system like Derive computes all
explicitly given integrals of Bronshtein and Semedyayev’s integral table [4]. The purpose of
this paper is to familiarize the reader with some of the underlying techniques which permit
computer algebra systems to efficiently solve a large variety of mathematical problems.
We begin by giving examples of important mathematical concepts and methods that are
available in general purpose computer algebra systems. Our examples are written in Maple
V.5 syntax.
1.1. Linear Algebra. One of the main topics of any computer algebra system is linear
algebra. Linear algebra algorithms are used throughout Mathematics; we will see examples
in connection with orthogonal polynomials and special functions later.
With Maple, we can compute the solution of a linear system of equations:
>
solve({x+2*a*y+3*z=4,5*x+6*y+7*z=8,9*x+10*y+11*z=12},{x,y,z});
−1
3
, y = 0}
{z = , x =
2
2
even if parameters are involved. For this purpose, Maple uses a Gauss type algorithm.
Note, that the above system is linear only if a is considered constant. If we consider a as
a variable, then a nonlinear system has to be solved:
>
solve({x+2*a*y+3*z=4,5*x+6*y+7*z=8,9*x+10*y+11*z=12},{a,x,y,z});
−1
3
,x=
, y = 0, a = a},
2
2
3
1
1
1
{z = − y + , a = 1, x = − y − , y = y} .
2
2
2
2
In a forthcoming section, we give more details on nonlinear systems of equations.
Maple has a large linear algebra library:
>
with(linalg);
{z =
Warning, new definition for norm
Warning, new definition for trace
November 1, 1998. Accepted for publication December 1, 1999. Recommended by F. Marcellán.
Leipzig, Department IMN, Gustav-Freytag-Str. 42 A, D-04277 Leipzig, Germany
(koepf@imn.htwk-leipzig.de).
† HTWK
77
ETNA
Kent State University
etna@mcs.kent.edu
78
Software for the algorithmic work with orthogonal polynomials
[BlockDiagonal , GramSchmidt , JordanBlock , LUdecomp, QRdecomp, Wronskian,
blockmatrix , charmat , charpoly , cholesky , col , coldim, colspace, colspan ,
companion, concat, cond , copyinto, crossprod , curl, definite, delcols,
delrows, det , diag , diverge, dotprod , eigenvals , eigenvalues, eigenvectors,
eigenvects, entermatrix , equal , exponential , extend, ffgausselim, fibonacci ,
forwardsub, frobenius, gausselim, gaussjord , geneqns, genmatrix , grad ,
hadamard , hermite, hessian, hilbert, htranspose, ihermite, indexfunc,
innerprod , intbasis, inverse, ismith, issimilar , iszero, jacobian , jordan,
kernel , laplacian , leastsqrs, linsolve, matadd , matrix , minor , minpoly ,
mulcol , mulrow , multiply, norm, normalize, nullspace, orthog, permanent ,
pivot , potential , randmatrix , randvector , rank , ratform, row , rowdim,
rowspace, rowspan, rref , scalarmul , singularvals, smith, stackmatrix ,
submatrix , subvector , sumbasis, swapcol , swaprow , sylvester , toeplitz ,
trace, transpose, vandermonde, vecpotent , vectdim, vector , wronskian]
You can see which procedures are available now. As an example, we compute the determinant
of the matrix


1 2a 3
 4 5 6 
7 8 9
by
det([[1,2*a,3],[5,6,7],[9,10,11]]);
−16 + 16 a
and the eigenvalues and eigenvectors for a = 2:
>
eigenvalues([[1,2,3],[5,6,7],[9,10,11]]);
√
√
0, 9 + 105, 9 − 105
>
eigenvectors([[1,2,3],[5,6,7],[9,10,11]]);
√
11 1 √
7 1√
−
105, 1, − +
105 }],
[9 + 105, 1, {
2
2
2 2
√
√
11 1
7 1√
+
105, 1, − −
105 }], [0, 1, {[1, −2, 1]}] .
[9 − 105, 1, {
2
2
2 2
Later we will show how important an efficient implementation of linear algebra can be.
>
1.2. Polynomial Arithmetic. A second major topic of computer algebra is polynomial
arithmetic.
P defines a polynomial
>
P:=(1-x)*sum(xˆk,k=0..9);
P := (1 − x) (1 + x + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 )
which is expanded by
>
expand(P);
1 − x10 .
Q is a second polynomial
>
Q:=1-xˆ5;
Q := 1 − x5
and normal cancels common factors of the ratio P/Q:
>
normal(P/Q);
x5 + 1
ETNA
Kent State University
etna@mcs.kent.edu
W. Koepf
79
by an application of the Euclidean algorithm.
A highlight of computer algebra is rational factorization since the underlying algorithms
(factorization modulo a prime and Hensel lifting, or the triple L algorithm, see e.g. [10]) are
not suitable for hand computations.
For example, the polynomial P can be factored over Q by the command
>
factor(P);
−(−1 + x) (x + 1) (x4 + x3 + x2 + x + 1) (x4 − x3 + x2 − x + 1)
and the following is a rational factorization of 1 − x105 :
>
factor(1-xˆ105);
−(−1 + x) (x6 + x5 + x4 + x3 + x2 + x + 1) (x4 + x3 + x2 + x + 1)(1 − x + x5
− x6 + x7 − x8 + x10 − x11 + x12 − x13 + x14 − x16 + x17 − x18 + x19
− x23 + x24 )(x2 + x + 1) (1 − x + x3 − x4 + x6 − x8 + x9 − x11 + x12 )
(1 − x + x3 − x4 + x5 − x7 + x8 )(1 + x + x2 − x5 − x6 − 2 x7 − x8 − x9
− x24 + x12 + x13 + x14 + x16 + x17 + x15 + x48 − x20 − x22 − x26 − x28
+ x31 + x32 + x33 + x34 + x35 + x36 − x39 − x40 − 2 x41 − x42 − x43 + x46
+ x47 )
Note that 105 is the smallest exponent such that the rational factorization of 1 − xn contains
coefficients different from 0 or ±1.
Next, we define a multivariate polynomial
>
Product(xˆ(2*k-1)-yˆk/kˆ2,k=1..7);
7
Y
yk
(x(2 k−1) − 2 )
k
k=1
whose expanded form is a huge expression
>
term:=expand(product(xˆ(2*k-1)-yˆk/kˆ2,k=1..7));
1
421
1
1 42 4
1 40 5
x y +
x27 y 12 +
x29 y 11 −
x16 y 18 −
x y
25
1225
176400
44100
16
113 31 10
1
16969 33 9
181
x y −
x18 y 17 +
x y −
x20 y 16
+
28224
28224
1587600
1587600
71
1
5609 35 8 1 44 3
47
x22 y 15 +
x9 y 22 +
x y − x y −
x24 y 14
−
235200
705600
176400
9
45360
1
161 37 7
5099
61
x11 y 21 +
x y −
x26 y 13 +
x13 y 20
+
396900
3600
3175200
6350400
2069 28 12
1
13
1
x y +
x15 y 19 +
x17 y 18 −
x4 y 25
−
564480
26880
181440
6350400
1
89 39 6
17147 30 11
559
x y −
x y +
x19 y 17
− x46 y 2 +
4
1600
3175200
3628800
1
13 41 5
18733 32 10
167
x6 y 24 +
x y −
x y +
x21 y 16
−
2822400
144
1587600
453600
13
21 34 9
2629
89
x8 y 23 −
x y +
x23 y 15 −
x10 y 22
−
6350400
1600
5080320
25401600
1091
1
209
1
x25 y 14 −
x12 y 21 −
x14 y 20 +
x y 27
+
1270080
90720
12700800
25401600
1
61 8 36
401
23
y x +
y 13 x27 −
y 19 x16
− y x48 + y 4 x43 −
9
3600
313600
635040
1
1
1 7 38
181
113
y 26 x3 + y 3 x45 −
y x +
y 12 x29 −
y 18 x18
+
6350400
4
64
129600
2822400
term := −
ETNA
Kent State University
etna@mcs.kent.edu
80
Software for the algorithmic work with orthogonal polynomials
1
1 6 40
1 11 31
421
y 25 x5 −
y x +
y x −
y 17 x20
2822400
36
900
6350400
1
1 10 33
1
1
1 38 6
y 24 x7 +
y x −
y 16 x22 +
y 23 x9 −
x y
+
1587600
576
20736
1016064
36
1
1
1
1 36 7
x25 y 13 −
y 15 x24 +
y 22 x11 −
x y
+
1764
14400
705600
49
1
1
y 21 x13 + x49 −
y 28
+
518400
25401600
which is a polynomial of degree 49 in x and of degree 28 in y.
It is beautiful (and will turn out to be essential in the sequel) that computer algebra
systems have no problems factoring such expressions over the rationals in reasonable time:
>
factor(term);
+
1
(x − y) (−y 2 + 4 x3 ) (−y 3 + 9 x5 ) (−y 5 + 25 x9 ) (−y 6 + 36 x11 )
25401600
(49 x13 − y 7 ) (−y 4 + 16 x7 )
1.3. Polynomial Systems. We return to the problem of nonlinear systems of equations.
Buchberger’s algorithm is an extension of Gaussian elimination to the multivariate case. It
constitutes—given a certain term order—an elimination scheme to find a normal form for
a given polynomial system, which can be used to find the general solution of a nonlinear
system.
We consider the following system of equations:
>
LIST:={9*B*A+4*d-6*c*d=0,
>
-9*a*b+9*B*A=0,
>
-18*B*A+12*d-12*c*d+4*dˆ2=0,
>
6*b*d-36*a*b+2*d+6*a*d=0,
>
-4*dˆ2+12*b*d-36*a*b+12*a*d=0,
>
-8*C-9+9*B+9*A-4*d+12*c=0,
>
-8*d-7+12*c+27*A+27*B-24*C=0,
>
8-3*a-3*b-32*C+27*A+27*B=0,
>
6-16*C+18*A+18*B-12*a+4*d-12*b=0,
>
4-12*a-12*b+8*d=0,
>
-C-2+3*c=0};
LIST := {9 B A + 4 d − 6 c d = 0, −9 a b + 9 B A = 0,
−18 B A + 12 d − 12 c d + 4 d2 = 0, 6 b d − 36 a b + 2 d + 6 a d = 0,
−4 d2 + 12 b d − 36 a b + 12 a d = 0, 4 − 12 a − 12 b + 8 d = 0,
−C − 2 + 3 c = 0, −8 C − 9 + 9 B + 9 A − 4 d + 12 c = 0,
−8 d − 7 + 12 c + 27 A + 27 B − 24 C = 0,
8 − 3 a − 3 b − 32 C + 27 A + 27 B = 0,
6 − 16 C + 18 A + 18 B − 12 a + 4 d − 12 b = 0} .
The solve command gives the general solution:
>
solve(LIST,{A,B,C,a,b,c,d});
1
1
1
1
1
1
1 1
5 1
+ d, A = d + , B = d, b = d, a = d + , C = + d, d = d},
6 6
3
3
3
3
3
3
2 2
1
1
1
1
1
1
1 1
5 1
{c = + d, A = d + , B = d, b = d + , a = d, C = + d,
6 6
3
3
3
3
3
3
2 2
1
1
1
1
1
1
5 1
d = d}, {c = + d, b = d, B = d + , A = d, a = d + ,
6 6
3
3
3
3
3
3
5 1
1
1
1
1
1
1 1
C = + d, d = d}, {c = + d, b = d + , B = d + , A = d,
2 2
6 6
3
3
3
3
3
{c =
ETNA
Kent State University
etna@mcs.kent.edu
81
W. Koepf
1 1
1
d, C = + d, d = d} .
3
2 2
In an application, we will see this example later.
a=
1.4. Differentiation and Integration. Differentiation is done using the differentiation
rules. This is an easy task. For the example function
>
input:=exp(x-xˆ2)*sin(xˆ6-1);
2
input := e(x−x ) sin(x6 − 1)
obviously the product rule is used:
>
derivative:=diff(input,x);
2
2
derivative := (1 − 2 x) e(x−x ) sin(x6 − 1) + 6 e(x−x ) cos(x6 − 1) x5 .
Integration is much more difficult, and the different systems have different approaches.
Whereas Derive uses a good collection of heuristics which enable the system to compute
all explicitly given integrals of Bronshtein and Semedyayev’s integral table [4], as already
mentioned, Maple uses an algorithmic approach.
In the sixties Risch developed an algorithm to compute an elementary antiderivative
whenever one exists. If no such antiderivative exists, his algorithm returns this information. Here elementary means that both integrand and antiderivative are rationally composed
of exponentials and logarithms (see e.g. [5]). Adjoining the complex unit i (denoted in Maple
by I), trigonometric functions can be treated as well.
We integrate the derivative above. This takes a little longer:
>
integral:=int(derivative,x);
5
4
3
2
1
integral := − I e((x−1) (I x +I x +I x +I x −x+I x+I))
2
5
4
3
2
1
+ I e(−(x−1) (I x +I x +I x +I x +x+I x+I)) .
2
Since i is adjoined, the resulting function looks not very familiar although it is algebraically
equivalent to our input function. In this particular case, we can convert both functions to
the same normal form by first converting exponentials to trigonometrics and applying then
rational factorization:
factor(convert(integral,trig));
−sin((x − 1) (x + 1) (x2 + x + 1) (x2 − x + 1)) (−cosh(x (x − 1)) + sinh(x (x − 1)))
>
factor(convert(input,trig));
−sin((x − 1) (x + 1) (x2 + x + 1) (x2 − x + 1)) (−cosh(x (x − 1)) + sinh(x (x − 1)))
>
Note, however, that one can prove that for general transcendental expressions a normal form
does not exist.
1.5. Differential Equations. In engineering and in natural sciences the symbolic and
numeric solution of differential equations is rather important. We enter an ordinary differential equation:
>
DE:=diff(y(x),x)=1+y(x)ˆ2;
∂
y(x) = 1 + y(x)2 .
DE :=
∂x
ETNA
Kent State University
etna@mcs.kent.edu
82
Software for the algorithmic work with orthogonal polynomials
After loading the DEtools package, we can use the procedure dfieldplot to plot a
direction field of the differential equation:
>
with(DEtools):
>
dfieldplot(DE,y(x),x=-5..5,y=-5..5);
4
y(x)
2
-4
0
-2
2
4
x
-2
-4
Given an initial value, the command DEplot plots a numeric solution by a Runge-Kutta type
approach:
>
DEplot({DE},{y(x)},x=-1..1,[[y(0)=0]]);
1.5
1
y(x)
0.5
-1
-0.5
0
0.5
x
1
-0.5
-1
-1.5
Using a combination of heuristic and algorithmic techniques, Maple can solve many ordinary
differential equations explicitly. Our initial value problem has the solution:
>
dsolve({DE,y(0)=0},y(x));
ETNA
Kent State University
etna@mcs.kent.edu
83
W. Koepf
y(x) = tan(x) .
As another example, we consider a linear differential equation of second order.
>
DE:=diff(y(x),x\$2)-y(x)=sin(x)*x;
∂2
DE := ( 2 y(x)) − y(x) = sin(x) x
∂x
with explicit solution
>
dsolve(DE,y(x));
1
1
1
1
1
1
1
y(x) = ( (− x + ) ex cos(x) + sin(x) x ex + (− x − ) e(−x) cos(x)
2
2
2
4
2
2
2
1
1
1
1
1
− x e(−x) sin(x))sinh(x) + (− (− x + ) ex cos(x) − sin(x) x ex
4
2
2
2
4
1
1
1
1
+ (− x − ) e(−x) cos(x) − x e(−x) sin(x))cosh(x) + C1 sinh(x)
2
2
2
4
+ C2 cosh(x) .
A plot based on a numerical computation is given by
>
DEplot({DE},{y(x)},x=-5..5,[[y(0)=0,D(y)(0)=1]]);
120
100
80
y(x) 60
40
20
-4
-2
0
2
4
x
-20
-40
The corresponding initial value problem has the explicit solution
>
solution:=dsolve({DE,y(0)=0,D(y)(0)=1 },y(x));
1
1
1
1
solution := y(x) = ( (− x + ) ex cos(x) + sin(x) x ex
2
2
2
4
1
1
1
1
+ (− x − ) e(−x) cos(x) − x e(−x) sin(x))sinh(x) + (
2
2
2
4
1
1
1
1
1
1
1
− (− x + ) ex cos(x) − sin(x) x ex + (− x − ) e(−x) cos(x)
2
2
2
4
2
2
2
1
1
− x e(−x) sin(x))cosh(x) + sinh(x) + cosh(x)
4
2
ETNA
Kent State University
etna@mcs.kent.edu
84
Software for the algorithmic work with orthogonal polynomials
which can be simplified to
>
simplify(convert(rhs(solution),trig));
1
1
1
sinh(x) + cosh(x) − cos(x) − sin(x) x .
2
2
2
1.6. Formal Power Series and Differential Equations. Next, we consider the opposite
problem to generate differential equations from expressions. This will lead us also to the
generation of power series of hypergeometric type.
>
with(share): with(FPS):
See ?share and ?share,contents for information about the share library
Share Library: FPS
Author: Gruntz, Dominik.
Description: FPS function attempts to find a formal power
series expansion for a function in terms of a formula for the
coefficients
we can, for example, compute the formal power series of the square of the inverse tangent
function:
>
FPS(arcsin(x)ˆ2,x);
(1.1)
∞
X
(k!)2 4k x(2 k+2)
.
(k + 1) (1 + 2 k)!
k=0
The algorithm behind this procedure is outlined below (see [16], [12]):
In the first step, by linear algebra techniques, a homogeneous linear differential equation
with polynomial coefficients is sought for the given expression
>
DE:=SimpleDE(arcsin(x)ˆ2,x,F);
∂2
∂
∂3
F(x)) + 3 x ( 2 F(x)) = 0 .
DE := (x − 1) (x + 1) ( 3 F(x)) + (
∂x
∂x
∂x
We call such a differential equation as well as the corresponding function holonomic. Next,
substituting the series
F (x) =
∞
X
ak xk
k=0
in this differential equation and equating coefficients yields the holonomic recurrence equation for ak :
>
RE:=SimpleRE(arcsin(x)ˆ2,x,a);
RE := −(k + 1)(a(k + 3) k 2 − k 2 a(k + 1) + 5 a(k + 3) k − 2 k a(k + 1)
− a(k + 1) + 6 a(k + 3)) = 0
which can be put in factored form
>
map(factor,collect(lhs(RE),a))=0;
(1.2)
−(k + 1) (k + 2) (k + 3) a(k + 3) + (k + 1)3 a(k + 1) = 0
Notice that the resulting recurrence equation gives ak+2 as a rational multiple of ak . If
Ak+1 is a rational multiple of Ak then it is called a hypergeometric term. From (1.2), ak
can be easily computed using two initial values. This finally generates the explicit series
representation (1.1). Note, however, that for an explicit representation the above factorization
is necessary; see (2.1).
By solving the differential equation for F (x) = arcsin2 (x) with two initial values, we
would like to reconstruct the input:
ETNA
Kent State University
etna@mcs.kent.edu
W. Koepf
>
>
85
solution:=dsolve({DE,F(0)=0,D(F)(0)=0,(D@@2)(F)(0)=2},F(x));
solution :=
p
p
1
F(x) = π 2 + I π ln(x + (x − 1) (x + 1)) − ln(x + (x − 1) (x + 1))2
4
convert(arcsin(x)ˆ2,ln);
p
−ln( 1 − x2 + I x)2
As before, we see that transcendental functions come in quite different disguises.
It turns out that sum and product of two holonomic functions are again holonomic, and
the corresponding holonomic (differential or recurrence) equations can be constructed from
the given holonomic equations by linear algebra (see [1], [2], [24], [23]).
As an example, we consider both the sum and the product of the functions f (x) =
arcsin x and g(x) = ex . Here are their holonomic equations:
>
DE1:=SimpleDE(arcsin(x),x,F);
∂
∂2
F(x)) x = 0
DE1 := (x − 1) (x + 1) ( 2 F(x)) + (
∂x
∂x
>
DE2:=SimpleDE(exp(x),x,F);
∂
F(x)) − F(x) = 0 .
DE2 := (
∂x
From these, we can compute the holonomic equations that are valid for f (x) + g(x) and
f (x) · g(x). For this purpose, we load the gfun package [23]:
>
with(gfun);
[Laplace, algebraicsubs, algeqtodiffeq , algeqtoseries , algfuntoalgeq , borel ,
cauchyproduct , diffeq ∗ diffeq, diffeq + diffeq, diffeqtorec, guesseqn,
guessgf , hadamardproduct , holexprtodiffeq , invborel , listtoalgeq ,
listtodiffeq , listtohypergeom, listtolist, listtoratpoly , listtorec,
listtoseries, listtoseries/Laplace, listtoseries/egf , listtoseries/lgdegf ,
listtoseries/lgdogf , listtoseries/ogf , listtoseries/revegf ,
listtoseries/revogf , maxdegcoeff , maxdegeqn, maxordereqn,
mindegcoeff , mindegeqn, minordereqn, optionsgf , poltodiffeq ,
poltorec, ratpolytocoeff , rec ∗ rec, rec + rec, rectodiffeq, rectoproc,
seriestoalgeq , seriestodiffeq , seriestohypergeom, seriestolist ,
seriestoratpoly , seriestorec, seriestoseries ]
The procedures ‘diffeq+diffeq‘ and ‘diffeq*diffeq‘ compute the differential
equations of sum and product, respectively:
>
‘diffeq+diffeq‘(DE1,DE2,F(x));
{(−x3 − 2 x2 + x − 1) D(F )(x) + (−x4 + 4 x2 ) (D(2) )(F )(x)
+ (1 − 2 x2 + x4 − x + x3 ) (D(3) )(F )(x), (D(2) )(F )(0) = C 0 }
>
‘diffeq*diffeq‘(DE1,DE2,F(x));
(−1 + x2 − x) F(x) + (x + 2 − 2 x2 ) D(F )(x) + (−1 + x2 ) (D(2) )(F )(x)
which we could also have obtained using SimpleDE directly:1
>
SimpleDE(arcsin(x)+exp(x),x,F);
1 Note that SimpleDE uses a slightly different approach (also based on linear algebra) that sometimes can find
differential equations of lower order than ‘diffeq+diffeq‘ and ‘diffeq*diffeq‘.
ETNA
Kent State University
etna@mcs.kent.edu
86
Software for the algorithmic work with orthogonal polynomials
(x − 1) (x + 1) (x − 1 + x2 ) (
∂3
∂
F(x))
F(x)) + (x − x3 − 2 x2 − 1) (
∂x3
∂x
∂2
F(x)) = 0
∂x2
SimpleDE(arcsin(x)*exp(x),x,F);
− x2 (x − 2) (x + 2) (
>
∂
∂2
F(x))
F(x)) + (x + 2 − 2 x2 ) (
2
∂x
∂x
+ (−1 + x2 − x) F(x) = 0 .
SimpleDE can also generate differential equations for some special functions, e.g., for the
Bessel functions Jn (x):
>
DE:=SimpleDE(BesselJ(n,x),x,F);
∂
∂2
F(x)) x = 0 .
DE := ( 2 F(x)) x2 − (n − x) (n + x) F(x) + (
∂x
∂x
Maple can solve this differential equation easily:
>
dsolve(DE,F(x));
F(x) = C1 BesselY(n, x) + C2 BesselJ(n, x) .
Even the more complicated differential equation of the product
>
DE:=SimpleDE(BesselJ(n,x)*exp(x),x,F);
∂2
∂
F(x)) + ( 2 F(x)) x2 = 0
DE := (2 x2 − n2 − x) F(x) − (−1 + 2 x) x (
∂x
∂x
can be treated by Maple
>
dsolve(DE,F(x));
F(x) = C1 BesselJ(n, x) ex + C2 BesselY(n, x) ex ,
but for the differential equation
>
DE:=SimpleDE(BesselJ(n,x)+exp(x),x,F);
(x − 1) (x + 1) (
DE := (2 x4 − 3 x2 n2 + x3 − 3 n2 x − x2 + n4 − n2 ) F(x)
∂
F(x))
+ (−n4 + 3 x2 + n2 + x3 − 2 x4 + 3 x2 n2 ) (
∂x
∂2
− (−2 x3 + n2 x + x2 − 3 n2 + 2 x) x ( 2 F(x))
∂x
3
∂
+ x2 (−2 x2 + n2 − x) ( 3 F(x)) = 0 ,
∂x
Maple fails
>
dsolve(DE,F(x));
F(x) = C1 ex + ex DESol
(
)
∂
∂2
Y(x)) (−2 x4 + x2 n2 − x3 ) ( ∂x
x (2 x + 1) ( ∂x
2 Y(x))
−
Y(x) −
,
−2 x2 + n2 − x
(−2 x2 + n2 − x)2
!
{ Y(x)}
although Maple was able to find the exponential summand (and hence reduced the order by
one).
Nevertheless, it is not astonishing that Maple cannot find all such solutions since for this
type of nonelementary solutions no algorithms exist.
ETNA
Kent State University
etna@mcs.kent.edu
87
W. Koepf
2. Special Functions and Computer Algebra. Power series of hypergeometric type—
the Bessel functions are also of this type—are the most important special functions.
The generalized hypergeometric series is given by
∞
∞
X
X
(a1 )k · (a2 )k · · · (ap )k k
a1 a2 · · · ap k
x
:=
x
(2.1) p Fq
A
x
=
k
b1 b2 · · · bq (b1 )k · (b2 )k · · · (bq )k k!
k=0
where (a)k :=
k
Q
k=0
(a+j −1) = Γ(a + k)/Γ(a) denotes the Pochhammer-Symbol or shifted
j=1
factorial.
Ak is a hypergeometric term and fulfills the recurrence equation (k ∈ N )
Ak+1 =
(k + a1 ) · · · (k + ap )
· Ak
(k + b1 ) · · · (k + bq )(k + 1)
with the initial value
A0 = 1 .
In Maple the hypergeometric series is given as hypergeom(plist,qlist,x), where
plist = [a1 , a2 , . . . , ap ] ,
and
qlist = [b1 , b2 , . . . , bq ] .
Here are some more hypergeometric examples:
>
F:=sqrt(x)*arcsin(sqrt(x))+sqrt(1-x);
√
√
√
F := x arcsin( x) + 1 − x
>
SUM:=FPS(F,x);
∞
X
4(−k) (2 k)! xk
SUM :=
(k!)2 (2 k − 1)2
k=0
>
convert(SUM,hypergeom);
−1 −1 1
,
], [ ], x)
2
2
2
F:=-(sqrt(Pi)/2*sqrt(x)*erf(sqrt(x))*(1+1/2/x)+exp(-x)/2);
√
1
1 1
1√ √
) − e(−x)
π x erf( x) (1 +
F := −
2
2 x
2
SUM:=FPS(F,x);
∞
X
(−1)k xk
SUM :=
k! (2 k + 1) (−1 + 2 k)
hypergeom([
>
>
k=0
>
convert(SUM,hypergeom);
−1 3
, , −x)
2 2
With convert, one can convert series into hypergeometric notation; KummerM is another
name for the confluent hypergeometric function 1 F1 .
−KummerM(
2.1. Summation. Whereas the FPS command converts expressions into series representations, the opposite question is to find explicit representations for sums. Note that the
remaining examples in this paper are taking from [17].
The main interest lies in sums of hypergeometric terms. As an example, we ask: Why
does Maple evaluate the sum
>
sum((-1)ˆk*binomial(n,k),k=a..b);
(b + 1) (−1)(b+1) binomial(n, b + 1) a (−1)a binomial(n, a)
+
−
n
n
ETNA
Kent State University
etna@mcs.kent.edu
88
Software for the algorithmic work with orthogonal polynomials
for arbitrary bounds a and b, but fails with
>
sum(binomial(n,k),k);X
binomial(n, k) ?
k
On the other hand, for the special bounds a = 0 and b = n, Maple is successful, again:
>
sum(binomial(n,k),k=0..n);
2n .
k n
, has a hypergeometric term
The reason for this behavior is that the first summand,
(−1)
k
n
antidifference (in the variable k), and the second, k , has not. The last sum is a definite sum
with natural bounds, i.e., the sum can be considered as infinite sum (k = −∞..∞), and the
result, again, is a hypergeometric term (in the variable n). We will see how we can find these
types of results algorithmically.
Note that sk is called an antidifference of ak , if
sk+1 − sk = ak ,
If such an antidifference is known, then summation is trivial since by telescoping
b
X
ak = (sb+1 − sb ) + (sb − sb−1 ) + · · · + (sa+1 − sa ) = sb+1 − sa .
k=a
This is very similar to the integration case.
The antidifference of the first summand is given by
>
sum((-1)ˆk*binomial(n,k),k);
k (−1)k binomial(n, k)
−
n
We can increase the level of user information by the command
>
infolevel[sum]:=3:
Let’s try to prove the statement
∞
X
(−1)k+1 (4 k + 1) (2 k)!
k=1
k! 4k (2 k − 1) (k + 1)!
=1
that was posed in SIAM Review 36, 1994, Problem 94-2 [21]. We compute an antidifference
>
summand:=(-1)ˆ(k+1)*(4*k+1)*(2*k)!/(k!*4ˆk*(2*k1)*(k+1)!):
>
sum(summand,k);
sum/indefnew:
indefinite summation
sum/extgosper:
applying Gosper algorithm to a(
(-1)ˆ(k+1)*(4*k+1)*(2*k)!/k!/(4ˆk)/(2*k-1)/(k+1)!
sum/gospernew:
a(
k
)/a(
k
-1):=
-1/2*(4*k+1)/(4*k-3)/(k+1)*(2*k-3)
sum/gospernew:
Gosper’s algorithm applicable
sum/gospernew:
p:=
4*k+1
sum/gospernew:
q:=
-2*k+3
sum/gospernew:
r:=
2*k+2
sum/gospernew:
degreebound:=
0
sum/gospernew:
solving equations to find f
sum/gospernew:
Gosper’s algorithm successful
sum/gospernew:
f:=
-1
sum/indefnew:
indefinite summation finished
−2
(k + 1) (−1)(k+1) (2 k)!
,
k! 4k (2 k − 1) (k + 1)!
k
):=
ETNA
Kent State University
etna@mcs.kent.edu
89
W. Koepf
with success. Taking the limit as n → ∞, one gets therefore
>
sum(summand,k=1..infinity);
sum/infinite:
infinite summation
1.
Moreover, from the user information we see that Gosper’s algorithm is applied.
If ak is a hypergeometric term, i.e., if2
bk
ak+1
=
∈ Q (k) ,
ak
ck
then Gosper’s algorithm decides whether or not the antidifference sk is a hypergeometric
term, and computes it in the affirmative case. In detail: Given3
bk
ak+1
=
,
ak
ck
bk , ck ∈ Q [k] ,
a representation
pk+1 qk+1
bk
=
,
ck
pk rk+1
pk , qk , rk ∈ Q [k]
is computed for which
gcd (qk , rk+j ) = 1
for all j ∈ N 0 .
This can be done by a resultant computation [11] or by rational factorization (see [17], [18],
[20]).
The essential fact is then: fk , defined by
sk =
rk
fk−1 ak
pk
is rational, and the above gcd-condition yields even fk ∈
geneous recurrence equation
Q [k], and fk satisfies the inhomo-
pk = qk+1 fk − rk fk−1 .
After calculating the degree of fk , only linear algebra is needed to compute fk . The output
of the procedure is either
sk =
rk
fk−1 ak
pk
or the statement “There is no elementary (= hypergeometric term) antidifference”.
In [17], many algorithms that are connected with Gosper’s, are treated in detail and their
Maple implementations are given.
>
2
3
Q(k): rational functions over Q.
Q[k]: polynomials over Q.
4 The packages ‘hsum.mpl‘ and ‘qsum.mpl‘ can be obtained from the URL www.imn.htwkleipzig.de/˜koepf/research.html.
ETNA
Kent State University
etna@mcs.kent.edu
90
Software for the algorithmic work with orthogonal polynomials
we can repeat the above calculation with the command
>
gosper((-1)ˆ(k+1)*(4*k+1)*(2*k)!/(k!*4ˆk*(2*k1)*(k+1)!),k);
(k + 1) (−1)(k+1) (2 k)!
.
−2
k! 4k (2 k − 1) (k + 1)!
The computation
>
gosper(1/k,k);
Error, (in gosper) no hypergeometric term antidifference exists
is not worthless since it proves that the harmonic numbers
Hn :=
n
X
1
k
k=1
do not constitute a hypergeometric term, corresponding to the fact that the logarithmic function
Z x
1
dt
ln x =
1 t
cannot be written in terms of exponentials.
Zeilberger’s algorithm is an extension of Gosper’s for definite sums. It generates, for
example, the right-hand sides of the identities
n X
n
k=0
n 2
X
n
k=0
= 2n ,
k
k
=
(2 n)!
2
(n!)
by the commands
>
closedform(binomial(n,k),k,n);
2n
>
closedform(binomial(n,k)ˆ2,k,n);
(2 n)!
.
(n!)2
Here are the details: If F (n, k) is a hypergeometric term in n and k, i.e.
F (n + 1, k)
F (n, k)
F (n, k + 1)
∈ Q (n, k) ,
F (n, k)
and
then Zeilberger’s algorithm generates a holonomic recurrence equation for
X
F (n, k) .
sn :=
k∈
Z
This is performed by starting with J = 1 and iterating if necessary: Set
ak := F (n, k) +
J
X
j=1
σj (n) F (n + j, k)
ETNA
Kent State University
etna@mcs.kent.edu
91
W. Koepf
with as yet undetermined variables σj . Apply Gosper’s algorithm to ak . In the last step,
solve the linear system at the same time for the coefficients of fk and the variables σj (j =
1, . . . , J). In the affirmative case, this yields
G(n, k + 1) − G(n, k) = ak .
Output: By summation one gets
sn +
J
X
σj (n) sn+j = 0 .
j=1
If the resulting recurrence equation is of first order, then sn is a hypergeometric term, given
by formula (2.1).
We would like to point out that the most time consuming part of Zeilberger’s algorithm
is the last step which is to solve a linear system. This linear system, however, often has many
variables, and its coefficients are polynomials or rational functions. Here, an efficient implementation of linear algebra is important. Furthermore, the resulting recurrence equation
usually needs factored coefficients because otherwise the results look unnecessarily complicated. We will see such a situation soon.
We give some examples: Each of the following series represents the Legendre polynomials:
k
n X
n
−n − 1
1−x
Pn (x) =
2
k
k
k=0
!
−n, n + 1 1 − x
= 2 F1
2
1
n
2
1 X n
(x − 1)n−k (x + 1)k
= n
2
k
k=0
!
n
−n, −n 1 + x
1−x
=
2 F1
1−x
2
1
bn/2c
2n − 2k
1 X
k n
(−1)
= n
xn−2k
2
k
n
k=0
!
−n/2, −n/2 + 1/2 1
2n
x n
=
2
2 F1
x
n
2
−n + 1/2
= xn 2 F1
−n/2, −n/2 + 1/2
1
!
1
1 − 2 .
x
Again, you see, that functions come in quite different disguises. How can we show that these
systems define the same family of functions? Zeilberger’s paradigm is to show that they
satisfy the same recurrence equation, then it is sufficient to check a finite number of initial
values.
Here are the recurrence equations for the different sums:
>
P:=’P’:
ETNA
Kent State University
etna@mcs.kent.edu
92
Software for the algorithmic work with orthogonal polynomials
>
sumrecursion(binomial(n,k)*binomial(-n-1,k)*((1x)/2)ˆk,k,P(n));
(n + 2) P(n + 2) − (2 n + 3) x P(n + 1) + (n + 1) P(n) = 0
>
sumrecursion(1/2ˆn*binomial(n,k)ˆ2*(x-1)ˆ(nk)*(x+1)ˆk,k,P(n));
(n + 2) P(n + 2) − (2 n + 3) x P(n + 1) + (n + 1) P(n) = 0
>
sumrecursion(1/2ˆn*(-1)ˆk*binomial(n,k)*
>
binomial(2*n-2*k,n)*xˆ(n-2*k),k,P(n));
(n + 2) P(n + 2) − (2 n + 3) x P(n + 1) + (n + 1) P(n) = 0
>
sumrecursion(xˆn*hyperterm([-n/2,-n/2+1/2],[1],11/xˆ2,k),k,P(n));
(n + 2) P(n + 2) − (2 n + 3) x P(n + 1) + (n + 1) P(n) = 0
We omit the computation of the initial values.
The Sumtohyper procedure of the hsum package is slightly more efficient than
‘convert/hypergeom‘ by converting a series into hypergeometric notation.
>
Sumtohyper(binomial(n,k)*binomial(-n-1,k)*((1-x)/2)ˆk,k);
1 1
Hypergeom([n + 1, −n], [1], − x)
2 2
>
Sumtohyper(1/2ˆn*binomial(n,k)ˆ2*(x-1)ˆ(n-k)*(x+1)ˆk,k);
1
x+1
1
)
( x − )n Hypergeom([−n, −n], [1],
2
2
x−1
>
Sumtohyper(1/2ˆn*(-1)ˆk*binomial(n,k)*
>
binomial(2*n-2*k,n)*xˆ(n-2*k),k);
1
1
1 1
1
2(−n) binomial(2 n, n) xn Hypergeom([− n + , − n], [−n + ], 2 ) .
2
2
2
2 x
The above computations show that all the given representations of the Legendre polynomials
agree.
To give a more advanced example of an application of Sumtohyper, we compute the
hypergeometric representation of the difference Pn+1 (x) − Pn (x) of successive Legendre
polynomials:
>
legendreterm:=binomial(n,k)*binomial(-n-1,k)*((1-x)/2)ˆk;
1 1
legendreterm := binomial(n, k) binomial(−n − 1, k) ( − x)k
2 2
>
Sumtohyper(subs(n=n+1,legendreterm)-legendreterm,k);
1 1
(x + x n − 1 − n) Hypergeom([−n, n + 2], [2], − x)
2 2
We give more examples of how Zeilberger’s algorithm can be applied in rather different
situations.
The following recurrence equation of the Apéry numbers
An :=
2
n 2 X
n
n+k
k=0
k
k
was an essential tool in Apéry’s proof of the irrationality of
ζ(3) =
>
∞
X
1
:
j3
j=1
sumrecursion(binomial(n,k)ˆ2*binomial(n+k,k)ˆ2,k,A(n));
(n + 2)3 A(n + 2) − (3 + 2 n) (17 n2 + 51 n + 39) A(n + 1) + (n + 1)3 A(n) = 0 .
ETNA
Kent State University
etna@mcs.kent.edu
W. Koepf
Dougall’s identity

93

1 =

7 F6
a
, 1+a−b, 1+a−c, 1+a−d, b+c+d−a−n, 1+a+n a, 1 + a2 , b, c, d, 1 + 2a − b − c − d + n, −n
2
(1 + a)n (1 + a − b − c)n (1 + a − b − d)n (1 + a − c − d)n
(1 + a − b)n (1 + a − c)n (1 + a − d)n (1 + a − b − c − d)n
(2.2)
is proven by
>
sumrecursion(hyperterm([a,1+a/2,b,c,d,1+2*a-b-c-d+n,-n],
>
[a/2,1+a-b,1+a-c,1+a-d,b+c+d-a-n,1+a+n],1,k),k,S(n));
−(a − d + n + 1) (n + 1 + a − c) (n + 1 − b + a) (−b − c − d + a + n + 1)
S(n + 1) + (1 + a + n) (n + 1 − c + a − d) (n + 1 − b + a − d)
(n − c + a + 1 − b) S(n) = 0 .
From this result, the right-hand side (2.2) of Dougall’s identity can be read off directly. The
complete computation is performed by
>
closedform(hyperterm([a,1+a/2,b,c,d,1+2*a-b-c-d+n,-n],
>
[a/2,1+a-b,1+a-c,1+a-d,b+c+d-a-n,1+a+n],1,k),k,n);
pochhammer(a + 1, n) pochhammer(−d − c + 1 + a, n)
pochhammer(−d + 1 − b + a, n) pochhammer(a + 1 − b − c, n) (
pochhammer(1 + a − d, n) pochhammer(1 + a − c, n)
pochhammer(1 + a − b, n) pochhammer(a − d + 1 − b − c, n)) .
Notice how important rational factorization is for such examples.
The Wilson polynomials have the representation5
!
−n, a+b+c+d+n−1, a−x, a+x Wn (x) = 4 F3
1 .
a + b, a + c, a + d
They include all classical systems like the Jacobi and Hahn polynomials. We get
>
sumrecursion(hyperterm([-n,a+b+c+d+n-1,a-x,a+x],
>
[a+b,a+c,a+d],1,k),k,W(n));
(d + a + n + 1) (n + 1 + a + c) (n + b + 1 + a) (a + 2 n + c + b + d)
(a + b + c + d + n) W(n + 2) − (2 n + 1 + a + b + c + d)(8 c d n
+ 8 b d n + b d a2 + 8 b c n + 3 b2 n + b c a2 + 2 b2 d + 6 a n b c
+ 7 d n2 + 6 b n c d + 3 d2 n + 2 c d2 + 2 b d2 + 7 c n2 + 3 c2 n
+ 2 c 2 d + 2 b c2 + 7 b n 2 + 2 b 2 c + 7 a n 2 + 8 a d n + 4 n 3 a
+ 2 d2 n2 + 4 d n3 + 2 c2 n2 + 4 c n3 + 2 b2 n2 + 4 b n3 + 6 a n b d
+ b2 + c2 + 8 a c n + d2 + 8 a b n + 4 a b c + 2 a b + 6 a n c d
+ b c d2 + b c2 d + a b2 d + 2 a b2 n + a c d2 + 2 a c2 n + a b d2
+ a b2 c + a b c2 + b2 c d + 4 a b c d + a c2 d + 3 a2 n + 6 b n2 a
+ 6 b n 2 d + 6 b n 2 c + 2 b 2 n d + 2 b 2 n c + 4 n 3 + 2 n 4 + 2 c2 n b
+ 2 a d2 + 2 a c2 + 2 a b2 + 6 c n2 a + 6 c n2 d + 2 c2 n d + 2 a2 c n
+ 2 a2 b n + 2 x2 b d + 2 x2 c d + 2 x2 a d + x2 a2 + 2 x2 b c
5 Sometimes
a different standardization is used. But this is not essential.
ETNA
Kent State University
etna@mcs.kent.edu
94
Software for the algorithmic work with orthogonal polynomials
+ 2 x2 a c + x2 d2 + 2 x2 a b + x2 b2 + x2 c2 + 4 b c d + 2 d2 n c
+ 2 d2 n b + 2 a2 d + 6 d n2 a + 4 a b d + 2 n2 + 2 a2 b + 2 a2 c
+ 2 b c + 4 a c d + 2 a d2 n + a2 + 2 a c + 3 b n + 2 b d + 2 c d
+ 3 d n + 2 a d + 2 a2 d n + 3 a n + 4 a x2 n + 4 b x2 n + 4 c x2 n
+ 4 d x2 n + 4 x2 n2 + 2 a x2 + 2 b x2 + 2 c x2 + 2 d x2 + 4 x2 n
+ 3 c n + 2 a2 n2 + c d a2 )W(n + 1) + (n + 1) (n + d + c) (n + b + d)
(n + b + c) (d + 2 n + a + b + c + 2) W(n) = 0 ,
a recurrence equation for Wn (x) which, however, is rather complicated since the middle
One knows from the theory that the recurrence equation has a special form which can be
found by the command Sumrecursion:
>
Sumrecursion(hyperterm([-n,n+a+b+c+d-1,a+x,a-x],
>
[a+b,a+c,a+d],1,k),k,W(n,x));
(x − a) (a + x) W(n, x) = ((a + d + n) (n + a + c) (n + b + a)
(a + b + c + d + n − 1) W(n + 1, x)) (
(a + 2 n + c + b + d) (2 n + b + a + c + d − 1)) − (
(a + d + n) (n + a + c) (n + b + a) (a + b + c + d + n − 1)
(a + 2 n + c + b + d) (2 n + b + a + c + d − 1)
(n + d + c − 1) (n + b + d − 1) (n + b − 1 + c) n
)
+
(2 n + b + a + c + d − 1) (2 n − 2 + b + d + a + c)
W(n, x) +
(n + d + c − 1) (n + b + d − 1) (n + b − 1 + c) n W(n − 1, x)
.
(2 n + b + a + c + d − 1) (2 n − 2 + b + d + a + c)
A similar recurrence equation exists in x:
>
Sumrecursion(hyperterm([-n,n+a+b+c+d-1,a+x,a-x],
>
[a+b,a+c,a+d],1,k),k,W(x,n));
(a + b + c + d + n − 1) n W(x, n) =
1 (x + d) (x + c) (x + b) (a + x) W(x + 1, n)
−
2
(2 x + 1) x
1 (x + d) (x + c) (x + b) (a + x) 1 (x − d) (x − c) (x − b) (x − a)
+
)
(
2
(2 x + 1) x
2
(−1 + 2 x) x
1 (x − d) (x − c) (x − b) (x − a) W(x − 1, n)
.
W(x, n) +
2
(−1 + 2 x) x
Clausen’s formula
2 F1
!2
a, b
= 3 F2
x
a+b+1/2 !
2a, 2b, a + b
x
a+b+1/2, 2a+2b gives the cases when the square of a 2 F1 function is a 3 F2 . The right-hand side is deduced
from the left-hand side by
>
sumrecursion(hyperterm([a,b],[a+b+1/2],x,j)*
>
hyperterm([a,b],[a+b+1/2],x,k-j),j,C(k));
−(k + 1) (2 a + 1 + 2 b + 2 k) (2 a + 2 b + k) C(k + 1)
+ 2 x (k + 2 b) (k + 2 a) (a + b + k) C(k) = 0
ETNA
Kent State University
etna@mcs.kent.edu
W. Koepf
95
computing the coefficient of the Cauchy product. The resulting hypergeometric term summand of the right-hand side can be obtained in one step by6
>
Closedform(hyperterm([a,b],[a+b+1/2],x,j)*
>
hyperterm([a,b],[a+b+1/2],x,k-j),j,k);
1
Hyperterm([2 b, 2 a, b + a], [a + b + , 2 a + 2 b], x, k)
2
The computation of a specific Feynman diagram [7] yields the representation
V (α, β, γ) = (−1)α+β+γ ·
· 2 F1
Γ(α+β +γ −d/2)Γ(d/2−γ)Γ(α+γ −d/2)Γ(β +γ −d/2)
Γ(α)Γ(β)Γ(d/2)Γ(α + β + 2γ − d)(m2 )α+β+γ−d
!
α + β + γ − d , α + γ − d/2 z .
α + β + 2γ − d
Since one is interested to compute this function for α, β, γ ∈ N , and since the computation is
easy for α, β, γ ∈ {0, 1}, recurrence equations in these variables can be used. Here is one in
β:
>
sumrecursion((-1)ˆ(alpha+beta+gamma)*
>
GAMMA(alpha+beta+gamma-d/2)*GAMMA(d/2-gamma)*
>
GAMMA(alpha+gamma-d/2)*GAMMA(beta+gamma-d/2)/
>
(GAMMA(alpha)*GAMMA(beta)*GAMMA(d/2)*
>
GAMMA(alpha+beta+2*gamma-d)*(mˆ2)ˆ(alpha+beta+gamma-d))*
>
hyperterm([alpha+beta+gamma-d,
>
alpha+gamma-d/2],[alpha+beta+2*gamma-d],z,k),k,V(beta));
8 β m4 (β + 1) (α + β + 1 + γ − d) z V(β + 2) + 2β m2
(4 γ + 2 z β + 2 z − z d + 2 α + 2 β − 2 d) (2 α + 2 β + 2 + 2 γ − d)
V(β + 1) +
(2 α + 2 β + 2 γ − d) (2 γ − d + 2 β) (2 α + 2 β + 2 + 2 γ − d) V(β)
=0.
Similarly, one obtains recurrence equations in α and γ.
In some instances, Zeilberger’s algorithm does not find the recurrence equation of lowest
order. Assume, for example, that we want to deduce the right-hand side from the left-hand
side of the identity
Sn =
n
X
k=0
n
3k
(−1)
= (−3)n .
k
n
k
Therefore, by Zeilberger’s algorithm we compute a recurrence equation
>
RE:=sumrecursion((-1)ˆk*binomial(n,k)*binomial(3*k,n),k,S(n));
RE := 2 (3 + 2 n) S(n + 2) + 3 (7 + 5 n) S(n + 1) + 9 (n + 1) S(n) = 0
and apply Petkovšek’s algorithm to find its hypergeometric term solutions
>
rechyper(RE,S(n));
{−3}
which gives the term ratio Sn+1 /Sn of the resulting hypergeometric term.
Here is another application of Petkovšek’s algorithm:
>
RE:=(n+4)*s(n+2)+s(n+1)-(n+1)*s(n)=0;
RE := (n + 4) s(n + 2) + s(n + 1) − (n + 1) s(n) = 0
6 The Closedform procedure differs from the closedform procedure in that the hypergeometric term is not
evaluated.
ETNA
Kent State University
etna@mcs.kent.edu
96
>
Software for the algorithmic work with orthogonal polynomials
rechyper(RE,s(n));
(5 + 2 n) (n + 1)
n+1
,−
}.
n+3
(3 + 2 n) (n + 3)
If continuous variables are involved, one can also compute holonomic differential equations
for sums by a Zeilberger type algorithm which is implemented in the sumdiffeq procedure.
We use some of the series representations of the Legendre polynomials to deduce the
corresponding differential equation:
>
sumdiffeq(binomial(n,k)*binomial(-n-1,k)*((1x)/2)ˆk,k,P(x));
∂
∂2
P(x)) + P(x) n (n + 1) = 0
−(−1 + x) (x + 1) ( 2 P(x)) − 2 x (
∂x
∂x
>
sumdiffeq(1/2ˆn*binomial(n,k)ˆ2*(x-1)ˆ(nk)*(x+1)ˆk,k,P(x));
∂
∂2
P(x)) + P(x) n (n + 1) = 0 .
−(−1 + x) (x + 1) ( 2 P(x)) − 2 x (
∂x
∂x
To show a quadratic transformation like
!
!
a, b a, a − b + 1/2 2
4x
2a
= (1 + x) · 2 F1
,
x
2 F1
2b (1 + x)2
b + 1/2
{
we prove that both sides satisfy the same differential equation, and show that enough initial
values agree:
>
sumdiffeq(hyperterm([a,b],[2*b],4*x/(1+x)ˆ2,k),k,Q(x));
∂2
∂
Q(x))
Q(x)) + 2 (1 + x) (−x2 + b x2 − 2 x a + b) (
∂x2
∂x
+ 4 Q(x) (x − 1) a b = 0
>
sumdiffeq((1+x)ˆ(2*a)*hyperterm([a,ab+1/2],[b+1/2],xˆ2,k),k,Q(x));
−x (x − 1) (1 + x)2 (
∂2
∂
Q(x))
Q(x)) + 2 (1 + x) (−x2 + b x2 − 2 x a + b) (
∂x2
∂x
+ 4 Q(x) (x − 1) a b = 0
>
eval([hypergeom([a,b],[2*b],4*x/(1+x)ˆ2)=
>
(1+x)ˆ(2*a)*hypergeom([a,a-b+1/2],[b+1/2],xˆ2),
>
diff(hypergeom([a,b],[2*b],4*x/(1+x)ˆ2)=
>
(1+x)ˆ(2*a)*hypergeom([a,a-b+1/2],[b+1/2],xˆ2),x)],x=0);
[1 = 1, 2 a = 2 a] .
On p. 258 in Ramanujan’s second notebook one finds the identity
!
3 !
1 2 1 2 ,
,
1
−
x
3 3
= (1 + 2x) 2 F1 3 3 x3 .
1 −
2 F1
1 + 2x
1 1 −x (x − 1) (1 + x)2 (
With Garvan [8] we can ask the question: For which A, B, C, a, b, c, d is
!
3 !
A, B a, b 3
1−x
d
= (1 + 2x) 2 F1
?
1−
x
2 F1
1 + 2x
C c A computation with Maple gives
>
first:=hyperterm([A,B],[C],1-((1-x)/(1+2*x))ˆ3,k);
(1 − x)3 k
pochhammer(A, k) pochhammer(B, k) (1 −
)
(1 + 2 x)3
first :=
pochhammer(C, k) k!
ETNA
Kent State University
etna@mcs.kent.edu
W. Koepf
97
>
second:=(2*x+1)ˆd*hyperterm([a,b],[c],xˆ3,k);
(1 + 2 x)d pochhammer(a, k) pochhammer(b, k) (x3 )k
second :=
pochhammer(c, k) k!
DE1:=sumdiffeq(first,k,S(x));
>
∂2
S(x)) + (1 + 2 x)(4 x4 + 9 B x3
∂x2
+ 9 A x3 − 8 C x3 + 3 x3 − 12 C x2 + 9 B x2 + 9 A x2 + 3 x2 − x
∂
S(x)) + 9 (x − 1)2 B A S(x) = 0
− 6 C x + 9 A x + 9 B x − C)(
∂x
DE2:=sumdiffeq(second,k,S(x));
>
∂2
S(x)) + (1 + 2 x)(2 x4 + 6 b x4
∂x2
− 4 d x4 + 6 a x4 + 3 b x3 + 3 a x3 + x3 − 6 c x + 4 x + 4 d x + 2
∂
S(x)) + (−12 x4 a d + 36 b a x4 + 4 d2 x4 − 12 x4 b d
− 3 c)(
∂x
− 2 x3 d − 6 x3 a d + 36 b a x3 − 6 x3 b d + 9 b a x2 − 12 d x − 4 d2 x
+ 12 c x d + 6 c d − 4 d)S(x) = 0
DE:=collect(lhs(DE1)-lhs(DE2),[S(x),diff(S(x),x)]);
>
DE1 := x (x − 1) (1 + x + x2 ) (1 + 2 x)2 (
DE2 := x (x − 1) (1 + x + x2 ) (1 + 2 x)2 (
DE := ((1 + 2 x)(4 x4 + 9 B x3 + 9 A x3 − 8 C x3 + 3 x3 − 12 C x2 + 9 B x2
+ 9 A x2 + 3 x2 − x − 6 C x + 9 A x + 9 B x − C) − (1 + 2 x)(2 x4
>
+ 6 b x4 − 4 d x4 + 6 a x4 + 3 b x3 + 3 a x3 + x3 − 6 c x + 4 x + 4 d x
∂
S(x)) + (9 (x − 1)2 B A + 12 x4 a d − 36 b a x4
+ 2 − 3 c))(
∂x
− 4 d2 x4 + 12 x4 b d + 2 x3 d + 6 x3 a d − 36 b a x3 + 6 x3 b d
− 9 b a x2 + 12 d x + 4 d2 x − 12 c x d − 6 c d + 4 d)S(x)
firstcoeff:=collect(frontend(coeff,[DE,S(x)]),x);
firstcoeff := (12 a d − 36 b a − 4 d2 + 12 b d) x4
+ (2 d + 6 a d − 36 b a + 6 b d) x3 + (−9 b a + 9 B A) x2
>
+ (−18 B A + 12 d + 4 d2 − 12 c d) x + 9 B A − 6 c d + 4 d
secondcoeff:=collect(frontend(coeff,[DE,diff(S(x),x)]),x);
secondcoeff := (4 − 12 b + 8 d − 12 a) x5
+ (6 + 18 B + 18 A − 16 C + 4 d − 12 a − 12 b) x4
+ (−3 b − 3 a + 8 + 27 B + 27 A − 32 C) x3
>
+ (12 c − 7 − 8 d − 24 C + 27 B + 27 A) x2
+ (−9 − 8 C + 9 A + 9 B − 4 d + 12 c) x − C − 2 + 3 c
LIST:={coeffs(firstcoeff,x)} union {coeffs(secondcoeff,x)};
LIST := {12 a d − 36 b a − 4 d2 + 12 b d, 9 B A − 6 c d + 4 d,
−9 b a + 9 B A, −18 B A + 12 d + 4 d2 − 12 c d,
6 + 18 B + 18 A − 16 C + 4 d − 12 a − 12 b, 4 − 12 b + 8 d − 12 a,
−3 b − 3 a + 8 + 27 B + 27 A − 32 C,
−9 − 8 C + 9 A + 9 B − 4 d + 12 c,
12 c − 7 − 8 d − 24 C + 27 B + 27 A, −C − 2 + 3 c,
2 d + 6 a d − 36 b a + 6 b d}
ETNA
Kent State University
etna@mcs.kent.edu
98
>
Software for the algorithmic work with orthogonal polynomials
solve(LIST,{A,B,C,a,b,c,d});
1
1
1
1 1
1
1
5 1
1
d, A = d + , b = d, C = + d, a = d + , c = + d},
3
3
3
3
2 2
3
3
6 6
1
1
1
1
1 1
1
1
{d = d, B = d, A = d + , b = d + , C = + d, a = d,
3
3
3
3
3
2 2
3
1
1
1
1 1
1
1
5 1
c = + d}, {d = d, B = d + , b = d, C = + d, a = d + ,
6 6
3
3
3
2 2
3
3
1
1
1
1
1
1 1
5 1
c = + d, A = d}, {d = d, B = d + , b = d + , C = + d,
6 6
3
3
3
3
3
2 2
5 1
1
1
a = d, c = + d, A = d} .
3
6 6
3
This leads to the unique solution
!
3 !
d/3, (1 + d)/3 d/3, (1 + d)/3 3
1−x
d
= (1 + 2x) 2 F1
1−
x
2 F1
1 + 2x
(1 + d)/2 (5 + d)/6 {d = d, B =
since the hypergeometric functions are symmetric in their upper parameters. Note that this is
exactly the computation from § 1.3. In this problem, a nonlinear system had to be solved.
There is a theory of basic hypergeometric (q-hypergeometric) terms Ak for which
Ak+1 /Ak is rational in q k . For almost all the results and algorithms corresponding q-versions
exist.
The corresponding series is called the basic hypergeometric series
r φs
a1
b1
a2
b2
∞
X
· · · ar Ak xk =
q,
x
:=
· · · bs k=0
∞
X
k
(a1 ; q)k · (a2 ; q)k · · · (ar ; q)k xk (−1)k q (2) 1+s−r
(b1 ; q)k (b2 ; q)k · · · (bs ; q)k (q; q)k
k=0
where (a; q)k :=
k−1
Q
1 − a q j is the q-Pochhammer-Symbol. Ak is a q-hypergeometric
j=0
term and fulfills the recurrence equation (k ∈ N )
Ak+1 :=
(1 − a1 q k ) · · · (1 − ar q k )
· Ak
(1 − b1 q k ) · · · (1 − bs q k )(1 − q k+1 )
with the initial value A0 := 1.
All classical orthogonal polynomial families have at least one, but most families possess
many q-analogues.
The q-analogue of Zeilberger’s algorithm gives for example for the q-Laguerre polynomials
−n q α+1 ; q n
q
(α)
n+α+1
φ
q,
−xq
,
Ln (x; q) =
1 1
q α+1 (q; q)n
the recurrence equation
>
Copyright 1998 , Harald Boeing & Wolfram Koepf
ETNA
Kent State University
etna@mcs.kent.edu
99
W. Koepf
Konrad − Zuse − Zentrum Berlin
qsumrecursion(qpochhammer(qˆ(alpha+1),q,n)/qpochhammer(q,q,n)*
qphihyperterm([qˆ(-n)],[qˆ(alpha+1)],q,x*qˆ(n+alpha+1),k),
>
q,k,L(n));
>
>
−q (−1 + q n ) L(n) + (−q 2 + q (2 n+α) x − q + q (n+α+1) + q (1+n) ) L(n − 1)
+ q (q − q (α+n) ) L(n − 2) = 0 .
The q-analogue of Zeilberger’s algorithm generates a third order recurrence equation for the
left-hand side of Jackson’s q-analogue of Dixon’s identity
n
X
(−1)k
k=−n
>
>
n+b
n+k
q
n+c
c+k
q
b+c
b+k
q
k(3k−1)
2
q
=
(q; q)n+b+c
:
(q; q)n (q; q)b (q; q)c
term:=(-1)ˆk*qbinomial(n+b,n+k,q)*qbinomial(n+c,c+k,q)*
qbinomial(b+c,b+k,q)*qˆ(k*(3*k-1)/2);
term := (−1)k qbinomial(n + b, n + k, q) qbinomial(n + c, c + k, q)
qbinomial(b + c, b + k, q) q (1/2 k (3 k−1))
>
RE:=qsumrecursion(term,q,k,S(n));
RE := −(−q (2 n) + q) (q n + 1) (−1 + q n ) q 3 S(n) − (q 5 − q (4+n+c+b) + q 4
+ q (3+2 n+b) + q (3+2 n+c) − q (3+2 n) − q (3+c+b+n)
− q (3+n+b) − q (3+n+c) + q 3 + q (2 n+b+2) + q (2 n+c+2)
− q (2 n+c+2+b) − q (3 n+c+2) − q (3 n+2) − q (3 n+b+2)
+ q (b+c+2+4 n) − q (3 n+1) + q (1+4 n+c+b) + q (4 n+c+b) )q
S(n − 1) + (q (2+2 n) − q (3 n+c+b) + q (2 n+b+2) + q 4
− q (4+n+c+b) − q (3 n+1+c+b) − q (3+n+b) + q (3+2 n+b) + q 6
+ q 5 − q (3 n+c+2+b) − q (4+n+b) + q (2 n+c+2) − q (3+n+c)
+ q (3+2 n+c) − q (4+n+c) )(q − q (n+c+b) ) S(n − 2) −
(q − q (n+c+b) ) (q 2 − q (n+b) ) (q 2 − q (n+c) ) (q 2 − q (n+c+b) )
S(n − 3) = 0 .
The q-analogue of Petkovšek’s algorithm decides whether a q-holonomic recurrence equation
has q-hypergeometric term solutions. It finds the right-hand side of the q-analogue of Dixon’s
identity:
>
qrecsolve(RE,q,S(n));
[[(q (n+1) − 1) S(n + 1) + (−q (1+c+b+n) + 1) S(n) = 0]] .
In many cases much simpler is Paule’s creative symmetrizing. With this method, we symmetrize the summand, and get the result in one step.
>
M:=qsimpcomb(subs(k=-k,term)/term);
M := q k
>
qsumrecursion((1+M)/2*term,q,k,S(n));
(1 − q n ) S(n) + (q (n+c+b) − 1) S(n − 1) = 0 .
ETNA
Kent State University
etna@mcs.kent.edu
100
Software for the algorithmic work with orthogonal polynomials
There exist similar algorithms for definite integration instead of summation.
The Bateman integral representation
Z1
t
(1 − t)
c−1
d−1
0
2 F1
a, b
c
!
Γ(c)Γ(d)
tx dt =
2 F1
Γ(c + d)
a, b
c+d
!
x
is proven by
>
intrecursion(tˆ(c-1)*(1-t)ˆ(d-1)*
>
hyperterm([a,b],[c],t*x,k),t,B(k));
−(k + 1) (k + d + c) B(k + 1) + B(k) x (b + k) (a + k) = 0
>
assume(d>0,c>0);
>
init:=int(tˆ(c-1)*(1-t)ˆ(d-1),t=0..1);
init := B(c˜, d ˜) .
Here B(c, d) denotes the Beta function
B(c, d) =
Γ(c) Γ(d)
.
Γ(c + d)
As part of the q-Askey-Wilson scheme [15] we have the Askey-Wilson polynomials
pn (x; a, b, c, d|q) = (ab; q)n (ac; q)n (ad; q)n a−n ·
4 φ3
q −n , abcdq n−1 , aei θ , ae−i θ q,
q
.
a b, a c, a d
The connection between those families can be written as
pn (x; α, β, γ, d|q) =
n
X
Cm (n) pm (x; a, b, c, d|q) ,
m=0
with connection coefficients Cm (n).
Askey and Wilson developed the following representation for Cm (n):
(α d, β d, γ d, q; q)n α β γ d q n−1 ; q m
2
q m −n m dm−n
Cm (n) =
m−1
(α d, β d, γ d, q, a b c d q
; q)m (q; q)n−m
· 5 φ4
q m−n , α β γ d q n+m−1 , a d q m , b d q m , c d q m q,
q
.
a b c d q2 m , α d qm , β d qm , γ d qm
In the general case this is not a q-hypergeometric term.
However, for the special case β = b and γ = c we get by the q-Zeilberger algorithm ([3],
compare [9], Sections 7.5 and 7.6)
(α/a; q)n−m αbcdq n−1 ; q m (q, bc, bd, cd; q)n an−m
:
Cm (n) =
(q, bc, bd, cd; q)m (abcdq m−1 ; q)m (q, abcdq 2m ; q)n−m
>
c:=’c’: d:=’d’:
>
term:=qpochhammer(alpha*d,beta*d,gamma*d,q,q,n)*
>
qpochhammer(alpha*beta*gamma*d*qˆ(n-1),q,m)/
>
qpochhammer(alpha*d,beta*d,gamma*d,q,a*b*c*d*qˆ(m-1),q,m)/
>
qpochhammer(q,q,n-m)*qˆ(mˆ2-n*m)*dˆ(m-n)*
ETNA
Kent State University
etna@mcs.kent.edu
W. Koepf
>
>
>
>
101
qphihyperterm([qˆ(m-n),alpha*beta*gamma*d*qˆ(n+m-1),
a*d*qˆm,b*d*qˆm,c*d*qˆm],
[a*b*c*d*qˆ(2*m),alpha*d*qˆm,beta*d*qˆm,gamma*d*qˆm],q,q,j):
qsumrecursion(subs({beta=b,gamma=c },term),q,j,C(m));
−(−1 + q m ) (−q + c d q m ) (c a q (n+m) b d − q) (b c q m − q) (−q + b d q m )
(−q 3 + a b c d q (2 m) ) (a q m − α q n ) C(m) + (−q 2 + c a q m b d)
(−q + a b c d q (2 m) ) q 2 (−q m + q (1+n) ) (−q 2 + α c q (n+m) b d)
C(m − 1) = 0
and similar results for α = a, γ = c and for α = a, β = b:
From these results one can derive the connection coefficients between many families of
the q-Askey-Wilson tableau by limit computations.
REFERENCES
[1] E. B EKE, Die Irreducibilität der homogenen linearen Differentialgleichungen, Math. Ann. 45 (1894), pp.
278–294.
[2]
, Die symmetrischen Functionen bei linearen homogenen Differentialgleichungen, Math. Ann. 45
(1894), pp. 295–300.
[3] H. B ÖING AND W. K OEPF , Algorithms for q-hypergeometric summation in computer algebra, J. Symbolic
Comput. (1999), to appear.
[4] I. N. B RONSHTEIN AND K. A. S EMEDYAYEV, Handbook of Mathematics, 3rd edition, Springer, New York,
1997.
[5] M. B RONSTEIN, Symbolic Integration I: Transcendental Functions, Springer, Berlin, 1997.
[6] B. W. C HAR ET AL ., Maple V Language Reference Manual, Springer, New York, 1991.
[7] J. F LEISCHER AND O. V. TARASOV, Calculation of Feynman diagrams from their small momentum expansion, Z. Phys. C64 (1994), pp. 413–425.
[8] F. G. G ARVAN, Ramanujan’s theories of elliptic functions to alternative bases—a symbolic excursion, J.
Symbolic Comput. 20 (1995), pp. 517–536.
[9] G. G ASPER AND M. R AHMAN, Basic Hypergeometric Series, Encyclopedia of Mathematics and its Applications, 35, Cambridge University Press, London and New York, 1990.
[10] K. O. G EDDES , S. R. C ZAPOR AND G. L ABAHN, Algorithms for computer algebra, Kluwer Academic
Publ., Boston/Dordrecht/London, 1992.
[11] R. W. G OSPER J R ., Decision procedure for indefinite hypergeometric summation, Proc. Natl. Acad. Sci. USA
75 (1978), pp. 40–42.
[12] D. G RUNTZ AND W. K OEPF , Maple package on formal power series, Maple Technical Newsletter 2 (2)
(1995), pp. 22–28.
[13] A. C. H EARN, Reduce User’s Manual, Version 3.6, RAND Co., Santa Monica, CA, 1995.
[14] R. D. J ENKS AND R. S. S UTOR, AXIOM. The Scientific Computation System, Springer, Berlin, 1993.
[15] R. K OEKOEK AND R. F. S WARTTOUW, The Askey-scheme of hypergeometric orthogonal polynomials and its q analogue, Report 94–05, Technische Universiteit Delft, Faculty of Technical Mathematics and Informatics, Delft, 1994; updated electronic version available at
http://aw.twi.tudelft.nl/˜koekoek/research.html.
[16] W. K OEPF, W, Power series in Computer Algebra, J. Symbolic Comput. 13 (1992), pp. 581–603.
[17]
, Hypergeometric Summation, Vieweg, Braunschweig/Wiesbaden, 1998.
[18] T. H. K OORNWINDER, On Zeilberger’s algorithm and its q-analogue: a rigorous description, J. Comput.
Appl. Math. 48 (1993), pp. 91–111.
[19] M ACSYMA : R EFERENCE M ANUAL, Macsyma, Inc., Arlington, MA 02174, USA.
[20] Y.-K. M AN AND F. J. W RIGHT, Fast polynomial dispersion computation and its application to indefinite
summation, Proc. of ISSAC 94, ACM Press, New York, (1994), pp. 175–180.
[21] A. W. OVERHAUSER AND Y. I. K IM, Problem 94–2, SIAM Review 36 (1994), p. 107.
[22] A. R ICH , J. R ICH AND D. S TOUTEMYER, DERIVE User Manual, Soft Warehouse, Inc., 3660 Waialae
Avenue, Suite 304, Honolulu, Hawaii, 96816-3236.
[23] B. S ALVY AND P. Z IMMERMANN, GFUN: A package for the manipulation of generating and holonomic
functions in one variable, ACM Trans. Math. Software 20 (1994), pp. 163–177.
[24] R. P. S TANLEY, Differentiably finite power series, European J. Combin. 1 (1980), pp. 175–188.
[25] S T. W OLFRAM, The Mathematica Book, Wolfram Media, Champaign, Illinois, and Cambridge University
Press, Cambridge, 1996.
```