Computer Algebra Algorithms forOrthogonal Polynomials and Special
Functions
Prof. Dr. Wolfram Koepf
Department of Mathematics
University of Kassel
http://www.mathematik.uni-kassel.de/~koepf
Online Demonstrations withComputer Algebra
• I will use the computer algebra system Maple to demonstrate and program the algorithms presented.
• Of course, we could also easily use anyother system like Mathematica or MuPAD.
• We first give a short introduction about the capabilities of Maple.
Computation of Power Series
• Assume, given an expression f dependingof the variable x, we would like to compute a formula for the coefficient ak of the power series
representing f(x).
∑∞
==
0
)(k
kk xaxf
Algorithm
• Input: expression f(x)• Determine a holonomic differential equation DE
(homogeneous and linear with polynomial coefficients) by computing the derivatives of f(x) iteratively.
• Convert DE to a holonomic recurrence equationRE for ak.
• Solve RE for ak.• Output: ak resp. È ak xk
Computation of HolonomicDifferential Equations
• Input: expression f(x)• Compute c0f(x) + c1f ´(x) + � + cJf(J)(x) with still
undetermined coefficients cj.
• Sort this w. r. t. linearly independent functions ± ·(x) and determine their coefficients.
• Set these zero, and solve the corresponding linear system for the unknowns c0, c1, …, cJ.
• Output: DE:=c0f(x) + c1f ´(x) + � + cJf(J)(x) = 0.
Algebra of Holonomic Functions
• We call a function that satisfies a holonomicdifferential equation a holonomic function.
• Sum and product of holonomic functions turn out to be holonomic.
• We call a sequence that satisfies a holonomicrecurrence equation a holonomic sequence.
• Sum and product of holonomic sequences are holonomic.
• A function is holonomic iff it is the generating function of a holonomic sequence.
Hypergeometric Functions
• The power series
whose coefficients Ak have rational term ratio
is called the generalized hypergeometricfunction.
,,,
,,
01
1 ∑∞
=
=
k
kk
q
p
qp xAxbb
aaF
�
�
1)()(
)()(
1
11
1
+⋅
++++
=+
+
k
x
bkbk
akak
xA
xA
q
p
kk
kk
�
�
Coefficients of Hypergeometric Functions
• For the coefficients of the hypergeometric function we get the formula
where (a)k = a(a+1)�(a+k-1) is called thePochhammer symbol (or shifted factorial).
, !)()(
)()(
,,
,,
0 1
1
1
1 ∑∞
=
=
k
k
kqk
kpk
q
p
qp k
x
bb
aax
bb
aaF
�
�
�
�
Examples of Hypergeometric Functions
Further examples: cos(x), arcsin(x), arctan(x), ln(1+x), erf(x), Ln
(α)(x), ..., but forexample not tan(x), ...
)(00 xFe x =
−
−⋅=
42/3sin
2
10
xFxx
Identification of Hypergeometric Functions
• Assume we have
• How do we find out which pFq(x) this is?
∑∞
=
=0
. k
kas
Identification Algorithm
• Input: ak
• Compute
and check whether the term ratio rk isrational.
• Factorize rk.• Output: read off the upper and lower
parameters and an initial value.
k
kk a
ar 1: +=
Recurrence Equations for Hypergeometric Functions
• Given a sequence sn, as hypergeometric sum
how do we find a recurrence equation for sn?
∑∞
−∞=
=k
n knFs ),(
Celine Fasenmyer’s Algorithm
• Input: summand F(n,k)• Compute
• Bring this into rational normal form, and set the numerator coefficient list w.r.t. k zero.
• Output: Sum the resulting recurrence equation for F(n,k) w.r.t. k.
∈++= ∑==
JjIi
knFikjnF
,...,0,...,0
),(),(
:ansatz · (n, k)
Drawbacks of Fasenmyer’s Algorithm
• In easy cases this algorithm succeeds, but:
– In many cases the algorithm generates arecurrence equation of too high order.
– The algorithm is slow. If, e.g., I = 2 and J = 2, then already 9 linear equations have to be solved.
– Therefore the algorithm might fail.
Indefinite Summation
• Given a sequence ak , find a sequence skwhich satisfies
• Having found sk makes definite summation easy since by telescoping for arbitrary m, n
• Indefinite summation is the inverse of ∆ .
. 1 kkkk sssa ∆=−= +
∑=
+ −=n
mkmnk ssa . 1
Gosper’s Algorithm
• Input: ak , a hypergeometric term.• Compute pk, qk, rk ± ·[k] with
• Find a polynomial solution fk of the recurrence equation qk+1 fk - rk+1 fk-1 = pk .
• Output: the hyperg. term
. 0 allfor 1),gcd( and 1
111 ≥== ++
+++ jrqr
q
p
p
a
ajkk
k
k
k
k
k
k
. 1 kkk
kk af
p
rs −=
Definite Summation:Zeilberger’s Algorithm
• Zeilberger had the brilliant idea to use a modified version of Gosper’s algorithm to compute definite hypergeometric sums
• Note however that, whenever sn is itself a hypergeometric term, then Gosper’s algorithm, applied to F(n,k), fails!
. ),(∑∞
−∞=
=k
n knFs
Zeilberger’s Algorithm
• Input: summand F(n,k)• For suitable J ± ´ set
ak := F(n,k) + σ1F(n+1,k) + � + σJ F(n+J,k) .• Apply the following modified version of Gosper’s
algorithm to ak :– In the last step, solve at the same time for the
coefficients of fk and the unknowns σj ± ·(n).
• Output by summation: The recurrence equationRE := sn + σ1 sn+1 + � + σJ sn+J = 0 .
The output of Zeilberger’s Algorithm
• We apply Zeilberger’s algorithm iteratively for J = 1,2, … until it succeeds.
• If J = 1 is successful, then the resulting recurrence equation for sn is of first order, hence sn is a hypergeometric term.
• If J > 1, then the result is a holonomic recurrence equation for sn.
• One can prove that Zeilberger’s algorithm terminates for suitable input.
• Zeilberger’s algorithm is much faster than Fasenmyer’s.
Representations of Legendre Polynomials
−+−=
−
−−
= ∑
= 2
1
1
1,
2
11)( 12
0
xnnF
x
k
n
k
nxP
kn
kn
( ) ( )
−+−−
−=+−
= −
=∑ 1
1
1
,
2
111
2
112
2
0 x
xnnF
xxx
k
n nkkn
n
kn
( )
+−
+−−
=
−
−= −
=∑ 212
22/
0
1
2/1
2/)1(,2/2
2
221
2
1
xn
nnF
n
nxx
n
kn
k
n nkn
n
k
k
n
−
−−=
212
11
1
2/)1(,2/
x
nnFxn
Dougall’s Identity
• Dougall (1907) found the following identity
++−−++−+−+−+
−+−−−++1
1,,1,1,1,2
,21,,,,2
1,67
nanadcbdacabaa
nndcbadcba
aF
. )1()1()1()1(
)1()1()1()1(
nnnn
nnnn
dcbadacaba
dcadbacbaa
−−−+−+−+−+−−+−−+−−++=
Clausen’s Formula
• Clausen’s formula gives the cases when a Clausen 3F2 function is the square of a Gauss 2F1 function:
• The right hand side can be detected from the left hand side by Zeilberger’s algorithm.
. 2
1,22
,2,2
2
1,
23
2
12
+++
+=
++ xbaba
babaFx
ba
baF
A Generating Function Problem
• Recently Folkmar Bornemann showed me a newly developed generating function of theLegendre polynomials and asked me to generate it automatically.
• Here is the question: Write
as a hypergeometric function!
∑∞
=
−+=
0
)( 1
:),,(n
nn zxP
n
nzxG
αα
Generating Function as a Double Sum
• We can take any of the four given hyper-geometric representations of the Legendre polynomials to write G(x,z,D) as double sum.
• Then the trick is to change the order of summation
. ),( 1
),( 1
0 00 0
nk
k nn
n
kk zxnp
n
nzxnp
n
n ∑∑∑ ∑∞
=
∞
=
∞
=
∞
=
−+=
−+ αα
Automatic Computation of Infinite Sums
• Whereas Zeilberger’s algorithm finds Chu-Vandermonde’s formula for n ± ´�0
the question arises to detect Gauss’ identity
for a,b,c ± © in case of convergence.
, )(
)(1
,12
n
n
c
bc
c
bnF
−=
−
)()(
)()(1
,12 bcac
bacc
c
baF
−Γ−Γ−−ΓΓ=
Solution
• The idea is to detect automatically
and then to consider the limit as m � �.• Using appropriate limits for the Γ function,
this and similar questions can be handledautomatically by a Maple package of Vidunas and Koornwinder.
−−−−=
+
1 ,
)()(
)()(1
,1212 c
baF
bacc
bcac
mc
baF
mm
mm
The WZ Method
• Assume we want to prove an identity
with hypergeometric terms f(n,k) and .
• Dividing by , we may put the identity intothe form
nk
sknf ~),( =∑∞
−∞=
. 1),(: == ∑∞
−∞=kn knFs
ns~
ns~
Rational Certificate
• If Gosper’s algorithm, applied to F(n+1,k)-F(n,k),is successful, then it generates a rational multiple G(n,k) of F(n,k), i.e. G(n,k) = R(n,k) F(n,k), such that
F(n+1,k) - F(n,k) = G(n,k+1) - G(n,k)• By telescoping, this proves sn+1�sn = 0, hence the
identity.• Second proof: Dividing by F(n,k), we may prove
a purely rational identity.
, ),(),(
)1,()1,(1
),(
),1(knR
knF
knFknR
knF
knF −++=−+
Differential Equations
• Zeilberger’s algorithm can easily be adapted to generate holonomic differential equations for hyperexponential sums
• For this purpose, the summand F(x,k) must be a hyperexponential term, i.e.
∈′
),(
),(
kxF
kxF
. ),()( ∑∞
−∞=
=k
kxFxs
· (x,k).
Petkovsek’s Algorithm
• Petkovsek’s algorithm is an adaption of Gosper’s.
• Given a holonomic recurrence equation, it determines all hypergeometric term solutions.
• Petkovsek’s algorithm is slow, especially if the leading and trailing terms have many factors. Maple 9 will contain a much more efficient algorithm due to Mark van Hoeij.
Combining Zeilberger’s andPetkovsek’s Algorithm
• Zeilberger’s algorithm may not give a recurrenceof first order, even if the sum is a hypergeometricterm. This rarely happens, though.
• Therefore the combination of Zeilberger’s algorithm with Petkovsek’s guarantees to find outwhether a given sum can be written as ahypergeometric term.
• Exercise 9.3 of my book gives 9 examples for this situation, all from p. 556 of – Prudnikov, Brychkov, Marichev: Integrals and Series,
Vol. 3: More Special Functions. Gordon Breach, 1990.
Examples
• As an example, we take
• and Exercise 9.3 (a), resp. PBM (7.5.3.32):
,...)3,2( , )()1(0
=−=
−∑
=
ccn
ck
k
n nn
k
k
. )()1(
)()2(1
12
,2
1,2
,2
1,,
34 nbb
nbbanbnb
a
baanF
n
n
+−−−=
+−+−
+−
Indefinite Integration
• To find recurrence and differential equations for hypergeometric and hyperexponential integrals, one needs a continuous version of Gosper’s algorithm.
• Almkvist and Zeilberger gave such an algorithm. It finds hyperexponential antiderivatives if those exist.
Recurrence and Differential Equations for Integrals
• Applying the continuous Gosper algorithm, one can easily adapt the discrete versions of Zeilberger’s algorithm to the continuous case.
• The resulting algorithms find holonomic recurrence and differential equations forhypergeometric and hyperexponential integrals.
Example 1
• As example, we would like to find holonomic equations for
Resulting recurrence equations:
( )∫ −=1
0
1:),( dtttyxS yx
0)()1(),1()2( =+++++− xSxyxSyx
0)()1()1,()2( =+++++− ySyyxSyx
Example ctd.
• Solving both recurrence equations shows that S(x,y) must be a multiple of
• Computing the initial value
proves that the above is an identity.
)2(
)1()1(~),(
++Γ+Γ+Γ
yx
yxyxS
1:)0,0(1
0
== ∫ dtS
Example 2
• The integral
satisfies the differential equation
from which it can be derived that
∫∞
++=
0224
2
)1)(()( dt
ttx
xxI
0)(8)()71()()1)(1)(1(
34
2
=+′++′′++−
xIxxIxxIxxxx
. )1(2
)(2 +
=x
xIπ
Rodrigues Formulas
• Using Cauchy’s integral formula
for the nth derivative makes the integration algorithm accessible for Rodrigues type expressions
( ) dtxt
th
i
nxh
nn ∫ +−
=γπ
)(
)(
2
!)(
1
. )()()( xhdx
dxgxf nn
n
nn =
Orthogonal Polynomials
• Hence we can easily show that the functions
are the Legendre polynomials, and
are the generalized Laguerre polynomials.
nn
n
n
n
n xdx
d
nxP )1(
!2
)1()( 2−−=
)(!
)()( nxn
nx
n xedx
d
xn
exL +−= α
αα
Generating Functions
• If F(z) is the generating function of the sequence an fn(x)
then by Cauchy’s formula and Taylor’s theorem
, )()(0
nn
nn zxfazF ∑
∞
==
. )(
2
11
!
)0(1)(
1
)(
dtt
tF
ian
F
axf
nn
n
nn ∫ +==
γπ
Laguerre Polynomials
• Hence we can easily prove the following generating function identity
for the generalized Laguerre polynomials.
n
nn
z
xz
zxLez )()1(0
)(11 ∑∞
=
−−− =− αα
Basic Hypergeometric Series
• Instead of considering series whose coeffi-cients Ak have rational term ratio Ak+1/Ak ±
·(k), we can also consider such series whose coefficients Ak have term ratio Ak+1/Ak ± ·(qk).
• This leads to the q-hypergeometric series
.; ,,
,,
01
1 ∑∞
=
=
k
kk
s
rsr xAxq
bb
aa
�
�
ϕ
Coefficients of the Basic Hypergeometric Series
• Here the coefficients are given by
where
denotes the q-Pochhammer symbol.
, )1();();();(
);();(1
2
1
1
rsk
k
k
k
ksk
krkk q
x
qbqb
qaqaA
−+
−=
�
�
( )∏−
=
−=1
0
1);(k
j
jk aqqa
Further q-Expressions
• q-Pochhammer symbol:
• q-factorial:
• q-Gamma function:
• q-binomial coefficient:
• q-brackets:
nn
qaqa );(lim);(∞→∞ =
[ ]k
kq q
qqk
)1(
);(!
−=
zzq q
qqz −
∞
∞ −=Γ 1)1();(
);()(
knk
n
qqqqq
k
n
−
=
);();(
);(
[ ] . 11
1 1−+++=−−= k
k
q qqq
qk �
q-Chu-Vandermonde Theorem
• For all classical hypergeometric theorems corresponding q-versions exist.
• For example, the q- Chu-Vandermondetheorem states that
and can be proved by a q-version of Zeilberger’s algorithm.
n
nnn
qc
qbc
b
cqq
c
bq
);(
);/(;
,12 =
−
ϕ
q-Hypergeometric Orthogonal Polynomials
• All classical orthogonal systems have (several) q-hypergeometric equivalents.
• The Little and the Big q-Legendre Polynomials, respectively, are given by
, ;,
)|(1
12
=
+−
qxqq
qqqxp
nn
n ϕ
. ;,
,,);;(
1
23
=
+−
qqcqq
xqqqcxP
nn
n ϕ
Operator Equations
• q-orthogonal polynomials satisfy q-holonomic recurrence equations with respect to n and – in the classical Hahn case– holonomic q-difference equations.
• For the latter one uses Hahn’s q-difference operator
. )1(
)()()(
xq
qxfxfxfDq −
−=
Scalar Products
• Given: a scalar product
with non-negative measure µ supported in the interval [a,b].
• Particular cases:– absolutely continuous measure dµ(x) = ρ(x)dx,– discrete measure ρ(x) supported by À,– discrete measure ρ(x) supported by q
�
.
∫=b
a
xdxgxfgf )()()(:, µ
Orthogonal Polynomials
• A family Pn(x) of polynomials
is orthogonal w. r. t. the measure µ(x) if
0 ,)( 1 ≠+′+= −n
nn
nnn kxkxkxP �
. if 0
if 0, 2
=≠≠
=nmd
nmPP
nmn
Classical Families
• The classical orthogonal polynomials can be alternatively defined as the polynomial solutions of the differential equation
• Conclusions:– n = 1 implies τ(x) = d x + e, d ≠ 0– n = 2 implies σ(x) = a x2 + b x + c– coefficient of xn implies λn = – n(a(n-1)+d)
. 0)()()()()( =+′+″ xPxPxxPx nnnn λτσ
Classification
• The classical systems can be classified according to the scheme
• σ(x) = 0 powers xn
• σ(x) = 1 Hermite polynomials
• σ(x) = x Laguerre polynomials
• σ(x) = x2 Bessel polynomials
• σ(x) = x2 – 1 Jacobi polynomials
Weight function
• The weight function ρ(x) corresponding to the differential equation satisfies Pearson’sdifferential equation
• Hence it is given as
( ) )()()()( xxxxdx
d ρτρσ =
. )(
)( )(
)(dx
x
x
ex
Cx
∫= στ
σρ
Classical Discrete Families
• The classical discrete orthogonal poly-nomials can be defined as the polynomial solutions of the difference equation
• Conclusions:– n = 1 implies τ(x) = d x + e, d ≠ 0– n = 2 implies σ(x) = a x2 + b x + c– coefficient of xn implies λn = – n(a(n-1)+d)
. 0)()()()()( =+∆+∇∆ xPxPxxPx nnnn λτσ
Classification
• The classical discrete systems can be classified according to the scheme
• σ(x) = 1 translated Charlier pols.
• σ(x) = x falling factorials
• σ(x) = x Charlier, Meixner, Krawtchouk pols.
• σ(x) = x (N+α-x) Hahn polynomials
Weight function
• The weight function ρ(x) corresponding to the difference equation satisfies Pearson’sdifference equation
• Hence it is given as
( ) )()()()( xxxx ρτρσ =∆
. )1(
)()(
)(
)1(
++=+
x
xx
x
x
στσ
ρρ
Classical q-Families
• The q-orthogonal polynomials of the Hahn class can be defined as the polynomial solutions of the q-difference equation
• Conclusions:– n = 1 implies τ(x) = d x + e, d ≠ 0– n = 2 implies σ(x) = a x2 + b x + c– coefficient of xn implies
. 0)()()()()( /1 =++ xPxPDxxPDDx nnnqnqq λτσ
[ ] [ ] [ ]qqqn ndnna −−−= 1/1λ
Classification
• The classical q-systems can be classified according to the scheme
• σ(x) = 0 powers and q-Pochhammers
• σ(x) = 1 discrete q-Hermite polynomials II
• σ(x) = x q-Charlier, q-Laguerre pols.
• σ(x) = (x-a q)(x-b q) Big q- Jacobi pols.
Weight function
• The weight function ρ(x) corresponding to the q-difference equation satisfies the q-Pearson differential equation
• Hence it is given as
( ) )()()()( xxxxDq ρτρσ =
. )(
)()1()(
)(
)(
qx
xxqx
x
qx
στσ
ρρ −+=
Computing Differential Equation from a Recurrence Equation
• From the differential or (q)-difference equation one can determine the three-term recurrence equation for Pn(x) in terms of the coefficients of σ(x) and τ(x).
• Using this information in the opposite direction, one can find the corresponding differential or (q)-difference equation from a given three-term recurrence equation.
Example 1
• Given the recurrence equation
one finds that for α = ¼ translated Laguerre polynomials, and for α < ¼, Meixner and Krawtchouk polynomials are solutions.
0)()1()()1()( 212 =++−−− ++ xPnxPnxxP nnn α
Example 2
• Given the recurrence equation
one finds that for every α there are q-orthogonal polynomial solutions.
0)()1()()( 112 =−+− +
++ xPqqxxPxP nnn
nn α
Epilogue
• Software development is a time consuming activity!
• Software developers love when their software is used.
• But they need your support.• Hence my suggestion: If you use one of the
packages mentioned for your research, please cite ist use!