Você está na página 1de 177

Polynomial Arithmeti

and Linear Systems


in Symboli Summation
Dissertation

zur Erlangung des akademis hen Grades


,,Doktor der te hnis hen Wissens haften\
verfasst von

Fabrizio Caruso

am
Institut fur Symbolis hes Re hnen (RISC)
Te hnis h-Naturwissens haftli he Fakultat
Johannes Kepler Universitat Linz
Dezember 2002

Erster Beguta hter: a.Univ.-Prof. Dr. Peter Paule


Zweiter Beguta hter: o.Univ.-Prof. Dr. Franz Winkler

Eidesstattli he Erklarung
I h versi here, dass i h die Dissertation selbstandig verfasst habe, andere als die
angegebenen Quellen und Hilfsmittel ni ht verwendet und mi h au h sonst keiner
unerlaubten Hilfe bedient habe.
Linz, Dezember 2002
Fabrizio Caruso

ii

Abstra t
The obje t of the thesis is twofold. Firstly we improve Zeilberger's algorithm for
symboli de nite hypergeometri summation by interpolating the solutions of the
related system of linear equations with rational fun tion oe ients. Se ondly
we develop a C++/Mathemati a program library for polynomial arithmeti that
implements fast multipli ation of sparse polynomials and some of the operations
related to homogeneous linear diophantine inequalities and equations as studied
in Ma Mahon's partition analysis and in its algorithmi version (
- al ulus),
namely exponentiation of low degree polynomials and division by powers of low
degree polynomials.

Zusammenfassung
Diese Dissertation setzt si h aus zwei Teilen zusammen. Zum einen bes haftigen
wir uns mit der Verbesserung des Algorithmus von Zeilberger zur symbolis hen
de niten hypergeometris hen Summation mittels Interpolation der Losungen des
korrespondierenden Systems von linearen Glei hungen mit rationalen Funktionen als Koezienten. Zum anderen entwi keln wir eine C++/Mathemati a
Programm-Bibliothek fur polynomiale Arithmetik, die die s hnelle Multiplikation von dunn besetzen Polynomen sowie einige der Operationen, die in Systemen von homogenen linearen diophantis hen Unglei hungen und Glei hungen
auftreten, implementiert, die in der Partitionsanalyse von Ma Mahon und ihrer
algorithmis hen Fassung (
-Kalkul) vorkommen, namli h Exponenzierung von
Polynomen niedrigen Grades und Division dur h Potenzen von Polynomen niedrigen Grades.

iii

iv

I would like to dedi ate my dissertation to my parents Giuseppe Caruso and


Margherita Mirabella and to my dear grandmothers Vin enza and Margherita
that have supported and en ouraged me during my studies.
Dedi o la mia tesi ai miei genitori Giuseppe Caruso e Margherita Mirabella e
alle mie are nonne Vin enza e Margherita he tanto mi hanno aiutato e in oraggiato durante i miei studi.

vi

A knowledgments

I would like to thank my adviser Prof. P. Paule who has helped me during my
studies at the RISC institute with his ontagious enthusiasm and with many
suggestions.
I would not have survived at RISC without the help and friendship of the
other members or the institute and in parti ular of the members of the Combinatori s Group: Cleopatra Pau, Axel Riese, Carsten S hneider and Burkhard
Zimmermann with whom I have had pleasant dis ussions on both mathemati al
and profane topi s.
I also thank Erhard Ai hinger of the Universal Algebra group at the University
of Linz, who has given me useful suggestions.
A thank goes to my olleagues Ralf Hemme ke and Manuel Kauers for their
patient help with Unix and LATEX te hni alities.

vii

viii

A knowledgments

Contents

Introdu tion

Stru ture of the Thesis

Main Contributions

Basi Notations

I Zeilberger's Algorithm in the Ma syma and Maxima


Computer Algebra Systems
11
1 Zeilberger's Algorithm in Ma syma

1.1 Introdu tion . . . . . . . . . . . . . . .


1.2 Some Theory . . . . . . . . . . . . . .
1.2.1 Some Fundamental De nitions .
1.2.2 Some Fundamental Fa ts . . . .
1.3 The Algorithms . . . . . . . . . . . . .
1.3.1 Gosper's Algorithm . . . . . . .
1.3.2 Zeilberger's Algorithm . . . . .
1.4 The Implementation . . . . . . . . . .
1.4.1 Gosper's Algorithm . . . . . . .
1.4.2 Zeilberger's Fast Algorithm . .
1.5 Performan e . . . . . . . . . . . . . . .
1.5.1 Timings . . . . . . . . . . . . .
1.5.2 Stability . . . . . . . . . . . . .
1.5.3 Future Improvements . . . . . .
1.6 Manual . . . . . . . . . . . . . . . . . .
1.6.1 Loading the les . . . . . . . .
1.6.2 The Commands . . . . . . . . .
1.7 Some Examples . . . . . . . . . . . . .
1.8 The Code . . . . . . . . . . . . . . . .
1.8.1 Low Level Routines . . . . . . .
ix

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

13

13
14
14
15
15
15
17
19
20
20
20
21
21
21
22
22
22
24
31
31

CONTENTS

1.8.2 Gosper Form Routines . . . . . . . . . . . . . . . . . . . . 32


1.8.3 Gosper Equation Routines . . . . . . . . . . . . . . . . . . 33
1.8.4 Gosper's and Zeilberger's Algorithm . . . . . . . . . . . . 33
II Solving Systems of Linear Equations by Interpolation
35
2 Cramer Driven Interpolation

2.1
2.2
2.3
2.4

2.5
2.6
2.7
2.8

Introdu tion . . . . . . . . . . . . . . . . . . .
Notation . . . . . . . . . . . . . . . . . . . . .
The Homogeneous Problem . . . . . . . . . .
Rational Coe ients . . . . . . . . . . . . . .
2.4.1 De nitions . . . . . . . . . . . . . . . .
2.4.2 Modular Approa h . . . . . . . . . . .
2.4.3 Bounding the Solutions . . . . . . . . .
Rational Fun tions . . . . . . . . . . . . . . .
2.5.1 De nitions . . . . . . . . . . . . . . . .
2.5.2 Interpolation . . . . . . . . . . . . . .
2.5.3 Bounding the Degrees of the Solutions
2.5.4 A Combination of the two Approa hes
Distributed Computation . . . . . . . . . . . .
The Pa kage . . . . . . . . . . . . . . . . . . .
2.7.1 Loading the Pa kages . . . . . . . . . .
2.7.2 The Commands . . . . . . . . . . . . .
Con lusion . . . . . . . . . . . . . . . . . . . .

3 Rational Interpolation

3.1
3.2
3.3
3.4
3.5

Introdu tion . . . . . . . . . . . . . . . . . . .
Re onstru ting Rational Fun tions . . . . . .
Cau hy Interpolation . . . . . . . . . . . . . .
Pade Approximation . . . . . . . . . . . . . .
Homogeneous Linear Systems . . . . . . . . .
3.5.1 The First Try . . . . . . . . . . . . . .
3.5.2 A Heuristi Method . . . . . . . . . . .
3.5.3 A Re ursive Method . . . . . . . . . .
3.5.4 A Hybrid Method . . . . . . . . . . . .
3.6 The Pa kage . . . . . . . . . . . . . . . . . . .
3.6.1 The Commands . . . . . . . . . . . . .
3.6.2 Modular Null Spa e Computation . . .
3.6.3 Completing the Null Spa e . . . . . . .
3.6.4 Hybrid Modular Symboli Null Spa e .
3.6.5 Rational Fun tion Interpolation . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

37

37
37
38
39
40
41
44
45
45
45
46
47
47
48
49
49
51

53

53
53
54
56
57
58
58
58
58
59
59
60
62
63
66

xi

CONTENTS

3.7 Con lusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67


4 Linear Systems in Zeilberger's Algorithm

4.1 Introdu tion . . . . . . . . . . . . . . . .


4.2 The Abstra t Model . . . . . . . . . . .
4.2.1 Notation . . . . . . . . . . . . . .
4.2.2 The Fundamental Bije tion . . .
4.2.3 More General Bije tions . . . . .
4.2.4 Some Useful Properties . . . . . .
4.2.5 Cardinality . . . . . . . . . . . .
4.2.6 Maximal Cardinality Property . .
4.3 Shift Quotients in Zeilberger's Algorithm
4.3.1 Notation and De nitions . . . . .
4.3.2 Interpretation of the Model . . .
4.3.3 Gosper Equation . . . . . . . . .
4.3.4 Lower Bounds on Degrees . . . .
4.3.5 Some Examples . . . . . . . . . .
4.4 Con lusion . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

69

69
69
69
70
74
76
77
78
79
80
81
89
91
92
93

III Polynomial Arithmeti Library

95

5 Combinatorial Interpretation of Division

97

5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8

Introdu tion . . . . . . . . . . . . . . . . .
De nitions . . . . . . . . . . . . . . . . . .
Existen e of the Inverse . . . . . . . . . .
Relation between C and q . . . . . . . . .
General Re urren e for C (i) . . . . . . . .
Lifting to the b(x ) Case . . . . . . . . . .
Combinatorial Meaning . . . . . . . . . . .
Binomial Case . . . . . . . . . . . . . . . .
5.8.1 Diagrams of Compositions . . . . .
5.8.2 Combinatorial Proof . . . . . . . .
5.9 Powers of Polynomials . . . . . . . . . . .
5.9.1 Initial Values . . . . . . . . . . . .
5.10 The Algorithms . . . . . . . . . . . . . . .
5.10.1 Modular Inverse . . . . . . . . . . .
5.10.2 Division by Powers of Polynomials
5.11 Summary . . . . . . . . . . . . . . . . . .
The PolyComb Pa kage
6.1 Introdu tion . . . . . . . . . . . . . . . . .
6.2 Stru ture of the Library . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

97
97
99
100
102
103
104
105
107
109
114
116
116
116
116
117
119

. . . . . . . . . . . . . 119
. . . . . . . . . . . . . 119

xii

CONTENTS

6.3
6.4
6.5
6.6
6.7
6.8
6.9

6.2.1 The Mathemati a Component . . . . . . .


6.2.2 The C++ Component . . . . . . . . . . .
6.2.3 The Communi ation . . . . . . . . . . . .
Relations among Classes . . . . . . . . . . . . . .
The Algorithms . . . . . . . . . . . . . . . . . . .
6.4.1 Dense Polynomials . . . . . . . . . . . . .
6.4.2 Sparse Polynomials . . . . . . . . . . . . .
The Mathemati a Component . . . . . . . . . . .
6.5.1 Loading . . . . . . . . . . . . . . . . . . .
6.5.2 The Parser . . . . . . . . . . . . . . . . . .
6.5.3 The Mathemati a Commands . . . . . . .
The C++ Library . . . . . . . . . . . . . . . . . .
6.6.1 Sparse Polynomial Library . . . . . . . . .
6.6.2 Dense Polynomial Library . . . . . . . . .
A Small Program . . . . . . . . . . . . . . . . . .
Ben hmarks . . . . . . . . . . . . . . . . . . . . .
6.8.1 Measurements . . . . . . . . . . . . . . . .
6.8.2 Polynomial Multipli ation and Expansion
6.8.3 Polynomial Exponentiation . . . . . . . .
Con lusion . . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

119
120
121
122
122
122
126
127
128
128
132
134
135
138
140
141
142
142
144
145

Appendix A

147

Appendix B

149

Curri ulum Vitae

153

Bibliography

155

Index

159

Introdu tion

The obje t of the thesis is twofold: improving Zeilberger's algorithm for symboli
de nite hypergeometri summation by re onstru ting the solutions of the related
system of linear equations with rational fun tion oe ients by interpolation,
and reating a library for polynomial arithmeti that implements some of the
operations related to homogeneous linear diophantine inequalities and equations,
namely fast multipli ation of sparse polynomials, exponentiation of low degree
polynomials, division by powers of low degree polynomials. The rst obje t is
overed in the rst two parts ( hapters 1, 2, 3, 4) and the se ond by the last part
( hapters 5, 6).
Zeilberger's algorithm (see [Zei90, [Zei91) is the standard omputational
method for symboli de nite hypergeometri summation. Its omputational
bottle-ne k is a sparse system of linear equations with rational fun tion oef ients. The rst two parts of the thesis deal with the implementation of the
algorithm, with two di erent approa hes aimed at speeding up the solution of
systems of linear equations with rational fun tion oe ients by polynomial and
rational interpolation, and with a new abstra t model that gives information on
the degree of the solutions to the systems of linear equations related to Zeilberger's algorithm.
The third part of the thesis deals with the ombinatorial interpretation and
with the implementation of some operations between polynomials that appear
as subproblems in the algorithms that implement Ma Mahon's
- al ulus (see
[Ma 16, [APR01a, [AP99, [APRS, [APR01 , [APR01d, [APR01e, [APR01b),
whi h is a omputational method for solving problems in onne tion with linear
homogeneous diophantine inequalities and equations.
The rst part of the thesis (Zeilberger's Algorithm in the Ma syma and Maxima Computer Algebra Systems) onsists of one hapter:
 Chapter 1: Zeilberger's Algorithm in Ma syma
In this hapter we des ribe Zeilberger's algorithm and our implementation
on the Ma syma and Maxima omputer algebra systems. Zeilberger's algorithm
solves the de nite hypergeometri summation problem, i.e. given a 2-variable
term F (n; k), we want to rewrite the de nite sum f (n) = Pnk=0 F (n; k) in a
1

Introdu tion

form free of P. This is done by nding a spe ial k-free linear re urren e with
polynomial oe ients for the summand F (n; k), whi h, under the ondition of
natural boundary for F (n; k), an be extended into a k-free homogeneous linear
re urren e for the sum f (n) with polynomial
Pm oe ients. The desired linear
re urren e for the summand has the form: i=0 ai (n)F (n + i; k) = G(n; k +1)
G(n; k). The sear h for this re urren e is done by guessing the order m of the left
hand side of this re urren e and then trying to nd the orresponding G(n; k)
of the right hand side by means of a modi ed Gosper's algorithm ([Gos78). We
note that a priori upper bounds for m an be given; however they turn out to
be too large and therefore not useful for pra ti al use. Gosper's algorithm for
the inde nite summation problem solves the hypergeometri teles oping problem,
i.e. given a hypergeometri term t(k), it de ides if there is a hypergeometri term
T (k) su h that t(k) = k T (k) = T (k + 1) T (k), and if it exists, it nds it.
The se ond part (Solving Systems of Linear Equations by Interpolation) ontains three hapters:
 Chapter 2: Cramer Driven Interpolation
 Chapter 3: Rational Interpolation
 Chapter 4: Linear Systems in Zeilberger's Algorithm
The rst two hapters des ribe two di erent methods for solving systems of
linear equations with rational fun tion oe ients. The last hapter deals with
linear systems related to Zeilberger's algorithm and it gives more understanding
of some aspe ts of Zeilberger's algorithm (whi h is des ribed in the rst hapter).
In Chapter 2 (Cramer Driven Interpolation) a well-known algorithm based
on Cramer's rule and on polynomial interpolation is des ribed. Su h algorithm
solves overdetermined systems of homogeneous linear equations over Q and over
the eld of rational fun tions over Q under the hypothesis that the null spa e is
one-dimensional. The algorithm re onstru ts the numerators and denominators
of the omponents of the solutions by omputing di erent homomorphi systems
over the nite elds Zp, with p prime.
In Chapter 3 (Rational Interpolation) we give a brief des ription of the standard theory of the rational fun tion re onstru tion problem, i.e. the problem of
nding a rational fun tion of small degree that is ongruent to some polynomial
modulo some other polynomial. Rational fun tion re onstru tion has two important appli ations: rational interpolation and rational fun tion approximation.
We have used this theory to build an algorithm that omputes the null spa e of a
re tangular matrix with entries in Q (y1 ; : : : ; yn) by re onstru ting some low degree omponents by rational fun tion interpolation and the others symboli ally.
This is done by plugging the omponents re onstru ted by rational fun tion interpolation into the system in order to simplify it. This approa h generalizes the

Introdu tion

previous work [RZ on methods for speeding up hypergeometri summation. In


su h a way the new system an be ome solvable by Gaussian elimination over
Q (yi ; : : : ; yir ) with 1  ij  n and r < n. Alternatively the system an be solved
by iterating the pro edure on the remaining variables.
In Chapter 4 (Linear Systems in Zeilberger's Algorithm) we onstru t an abstra t model to study the degree of the polynomial oe ients of the linear re urren e whi h is omputed by Zeilberger's algorithm. Given a proper hypergeometri term F (n; k) and a linear shift operator L of order d with polynomial
oe ients, we prove that the Gosper form (p(n; k), q(n; k), r(n; k)) of the shift
quotient in k of LF (n; k) is su h that the degree in n of q(n; k) and r(n; k) an be
bounded independently of d. This gives some insight on the degree in n of all the
polynomial oe ients ai (n) of the linear re urren e satis ed by F (n; k) that is
omputed by Zeilberger's algorithm. We do this in two steps: rstly by proving
the existen e of ertain bije tions between subsets of the natural numbers whi h
re e t the properties of the Gosper form ; se ondly by interpreting this abstra t
model in terms of the polynomials involved in the Gosper form.
The third part of the thesis (Polynomial Arithmeti Library) ontains two
hapters:
 Chapter 5: Combinatorial Interpretation of Division
 Chapter 6: The Polynomial Pa kage
In Chapter 5 (Combinatorial Interpretation of Division) we give a ombinatorial interpretation of polynomial division and of modular inverse of a polynomial.
Su h interpretation relates the oe ients of the modular inverse of a polynomial with ompositions (i.e. ordered partitions) of non-negative integers. We
will des ribe the re urren e for the oe ients of the polynomial y(x) su h that
p(x)  y (x)  1 mod xl , where l is a non-negative integer and p(x) is an invertible
polynomial over a ring R, i.e. x - p(x), for whi h therefore y(x) exists. We will
use a trans endental extension of R as a tool to study this re urren e.
Chapter 6 (The Polynomial Pa kage) ontains a des ription of algorithms and
the stru ture of a C++/Mathemati a library for fast polynomial arithmeti and
a manual of both the Mathemati a omponent and the C++ omponent of the
library. The library has two parts: a C++ implementation of fast polynomial
arithmeti for dense and sparse polynomials, and a Mathemati a [Wol99 interfa e whi h makes it possible to use the library from within the Mathemati a
environment. The implemented methods and operators between polynomials involve addition, multipli ation, exponentiation and division with remainder and
various other auxiliary methods.
The C++ omponent of the library makes full use of the obje t oriented
paradigm and of generi programming through the extensive use of templates.
1

Introdu tion

Thus polynomials over rings are de ned over any ring of oe ients that provide
the ne essary methods (operations) required by a ring.

Stru ture of the Thesis

Part 1

Linear Systems

Polynomial Arithmeti

Part 2

Part 3

Zeilberger's Algorithm in the

Solving Systems of Linear

Polynomial Arithmeti

Ma syma and Maxima

Equations by Interpolation

Library

Computer Algebra Systems

Chapter 1

Chapter 2

Chapter 5

Zeilberger's Algorithm in

Cramer Driven

Combinatorial Interpretation

Ma syma

Interpolation

of Division

First implementation
on a publi domain
system

It ould be used
to parallelize
Zeilberger's Algorithm

Relation between
polynomial division
and integer
ompositions

Chapter 3

Chapter 6

Rational Interpolation

The Polynomial Pa kage

It an be used for
a probabilisti
Zeilberger's Algorithm

Implementation of fast
polynomial arithmeti
related to some
ombinatorial problems

Chapter 4
Linear Systems in
Zeilberger's Algorithm

New abstra t model


to undertsand
Zeilberger's Algorithm

Stru ture of the Thesis

Main Contributions

The following items present a ondensed list of my s ienti ontributions whi h


I have a hieved in my PhD thesis work and whi h are new.
 The rst implementation of Zeilberger's algorithm for de nite hypergeometri summation in the Maxima and Ma syma omputer algebra systems.
(Chapter 1)
 Two Mathemati a libraries for the omputation of the null spa e of a ho-

mogeneous system of linear equations by interpolation. The se ond library


uses a hybrid method based on rational interpolation that generalizes [RZ
(Chapter 2 and Chapter 3).

 A Combinatorial model that interprets the Gosper form of a rational fun -

tion in a new way. The appli ation of this model to the study of the degree
of the omponents of the solutions of the linear systems related to Zeilberger's algorithm (Chapter 4).

 Combinatorial interpretation of the omputation of polynomial division and

of the modular inverse of a polynomial in terms of integer ompositions


(Chapter 5).

 A C++/Mathemati a library for polynomial arithmeti with spe ial fo us

on the omputation of modular powers of polynomials and division by powers of polynomials (Chapter 6).

Main Contributions

Basi Notations

N
Z
Zp
Q
;

R[x
R[x1 ; : : : ; xn
R[[x
Rm;n
F ( x)
jaj
jAj
jjajj1
jjajj2
ajb
a-b
dae
ba
[a1 ; : : : ; an

i
:=


set of non-negative integer numbers


ring of integer numbers
eld of the residue lasses modulo p (p is a prime)
eld of rational numbers
empty set
ring of polynomials in x over the ring R
ring of polynomials in x1 ,...,xn over the ring R
ring of power series in x over R
ring of m  n matri es over the ring R
eld of rational fun tions over the eld F
absolute value of a
determinant of A
1-norm of a ve tor
Eu lidean norm of a ve tor
a divides b
a does not divide b
smallest integer greater or equal to a (a is real)
greatest integer less or equal to a (a is real)
n-tuple of a1 ,...,an
omplexity lass in the sense of [GKP94
\if and only if"
assignment
end of proof

10

Basi Notations

Part I
Zeilberger's Algorithm in the
Ma syma and Maxima Computer
Algebra Systems

11

Chapter 1
Zeilberger's Algorithm in
Ma syma

1.1 Introdu tion


We present the rst implementation within the Ma syma and Maxima omputer algebra systems (see [S h, [Ma 96) of Zeilberger's Fast Algorithm for
the de nite summation problem for the large lass of proper hypergeometri
terms, i.e.
given a 2-variable term F (n;Pk), we want to rewrite the de nite sum
Pn
f (n) = k=0 F (n; k) in a form free of . We do this by nding a spe ial k-free
linear re urren e with polynomial oe ients for the summand F (n; k), whi h,
under the ondition of natural boundary for F (n; k), an be extended into a k-free
homogeneous linear re urren e for the sum f (n) with polynomial oe ients. The
desired linear re urren e for the summand has the form: Pmi=0 ai(n)F (n + i; k) =
G(n; k + 1) G(n; k). The sear h for this re urren e is done by guessing the
order m of the left hand side of this re urren e and then trying to nd the
orresponding G(n; k) of the right hand side by means of a modi ed Gosper's
algorithm (We note that a priori upper bounds for m an be given; however they
turn out to be too large and therefore not useful for pra ti al use). A new version
of Gosper's algorithm for this purpose has also been implemented and in luded
in this pa kage.
Gosper's algorithm for the inde nite summation problem solves the hypergeometri teles oping problem, i.e. given a hypergeometri term t(k), it de ides if
there is a hypergeometri term T (k) su h that t(k) = k T (k) = T (k +1) T (k),
and if it exists, it nds it.
The standard Gosper's algorithm annot be used in Zeilberger's algorithm
be ause it does not take into a ount that there are some polynomial parameters.
Therefore a modi ed version of this algorithm, in whi h the polynomial unknown
parameters ai's are taken into a ount, has been implemented and it is used by
our implementation of Zeilberger's algorithm to ompute the right hand side of
13

14

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

the desired re urren e.


These implementations do not onsider the more general q- ase, for whi h
a Mathemati a version has already been developed at RISC, University of Linz,
Austria (see [PR97). Moreover we remark that at RISC a Mathemati a version of
Zeilberger's fast algorithm for the ordinary ase q = 1, onsidered in this report,
has already been implemented by Paule and S horn [PS95. Both pa kages are
available at the world wide web address
http://www.ris .uni-linz.a .at/resear h/ ombinat/ris /

1.2 Some Theory


We now introdu e the basi de nitions of the theory of de nite and inde nite
hypergeometri summation and some fundamental results of the theory whi h
are ne essary for the orre tness of Zeilberger's fast algorithm and Gosper's algorithm.
For a formal des ription of Gosper's algorithm and Zeilberger's fast algorithm
and of the proofs of their orre tness we refer to Gosper's original paper [Gos78
and to Zeilberger's papers [Zei90, [Zei91, respe tively. For a tutorial des ription
of these algorithms we refer to [GKP94 and [PWZ97.
1.2.1 Some Fundamental De nitions

We are interested in treating sequen es (t(n))n but in our algebrai setting we


will treat terms t(n) with free variable n over the integers.
De nition 1.2.1. Given a term t(n) over a eld K of hara teristi 0, we all
t(n + 1)=t(n) shift quotient of t(n).
De nition 1.2.2. A term t(n) over a eld K of hara teristi 0 is said to be
hypergeometri if and only if the shift quotient t(n +1)=t(n) is a rational fun tion
in n with oe ients in K .
We an extend this de nition to multivariate terms in the natural way:
De nition 1.2.3. A term t(x1 ; : : : xm ) over a eld K of hara teristi 0 is said to
be hypergeometri with respe t to xs, where 1  s  m, if and only if the quotient
t(x1 ; : : : ; xs + 1; : : : xm )=t(x1 ; : : : ; xm ) is a rational fun tion in n with oe ients
in K .

1.3.

15

THE ALGORITHMS

De nition 1.2.4. Given a 2-variable term F (k; n) over a eld K of hara teristi
0 is said proper hypergeometri if and only if it is in the following form:
QI
i=0 ai k
QJ
j =0 dj k

( + bin + i)! xk
( + ej n + fi)!
where p(k; n) is a polynomial in k and n, and ai , bi , i dj , ej , fi are integers and
x is a parameter.
This de nition extends in the natural way to m-variable ase, where m  2.
F (n; k) = p(n; k)

1.2.2 Some Fundamental Fa ts

In the following we will always denote by K a eld of hara teristi 0.

Property 1.2.1. Given a hypergeometri term t(n) over a eld K . If there is


a hypergeometri term T (n) su h that t(n) = T (n + 1) T (n), then we have
t(n + 1)=t(n) = r(n)T (n) where r(n) is a rational fun tion.
Property 1.2.2. Any proper hypergeometri term F (n; k) is hypergeometri with
respe t to n and k.
Theorem 1.2.3. (Existen e of a k-free re urren e) Let F (n; k) be a proper
hypergeometri term, then F satis es a nontrivial re urren e of the form:
m
X
i=0

ai (n)F (n; k) = G(n; k + 1) G(n; k);

(1.1)

where G(n; k)=F (n; k) is a rational fun tion in n and k.

We will refer to the rational fun tion G(n; k)=F (n; k) of Theorem 1.2.3 as
\rational erti ate".

1.3 The Algorithms


1.3.1 Gosper's Algorithm

Gosper's algorithm solves the hypergeometri inde nite summation problem:


given a hypergeometri term t(n), it de ides whether there exists another hypergeometri term T (n) su h that t(n) = T (n +1) T (n). See Algorithm 1.1 for
the pseudo- ode.

16

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

Algorithm 1.1 Gosper's Algorithm


Input: A hypergeometri term t(n) over a eld K of hara teristi 0.
Output: If there is a hypergeometri term T (n) su h t(n) = T (n + 1) T (n),
then return T (n), else return ``no hypergeometri solution''
1: Compute rat t (n) := t(n + 1)=t(n);
2: Write rat t (n) in the following form:
rat t (n) =

3:

4:
5:
6:
7:

p(n + 1) q (n)
p(n) r(n + 1)

(1.2)

where g d(q(n); r(n + j )) = 1 for all positive integers j 's, and p, q, and r are
polynomials. This pro ess is des ribed in detail in Chapter 4 in Algorithm 4.1.
Solve the following linear polynomial re urren e equation:
p(n) = q (n)s(n + 1) r(n)s(n);
(1.3)
where the polynomial s(n) is the unknown.
if no s(n) found then
return ``no hypergeometri solution''
else
return
1
T (n) = s(n+1) q(n)

s(n) r(n)

1)

 t( n ) :

1.3.

THE ALGORITHMS

17

Remark 1.3.1. The spe ial form for the rational fun tion ratt , alled Gosper
ondition, (see Algorithm 1.1) an be omputed by for ing the g d ondition by

resultant omputation and simple rewriting. For more details see Algorithm 4.1.
In the proper hypergeometri ase, this step an also be done by simple inspe tion.
Remark 1.3.2. The linear re urren e equation (4.71) in Algorithm 1.1, known as
Gosper equation, an be omputed by plugging into it a polynomial with unknown
oe ients, whose degree an be properly bounded. For more details on how to
bound the degree of the polynomial we refer to [GKP94, page 227.
Why it works

For a formal proof of the orre tness of this algorithm we refer to [PWZ97,
[Gos78, [S h95 and [GKP94, pages 223{241.
The idea of this algorithm is that we an rewrite an inde nite hypergeometri
summation problem into a linear re urren e. In fa t, by Property 1.2.1 and Property 1.2.2, we have that the solution T (n) of the inde nite summation problem
and the input fun tion t(n) must di er by a fa tor given by rational fun tion r(t):
T (n) = r(n)t(n):
By plugging this into the desired property: t(n) = T (n + 1) T (n) and by
dividing both sides by t(n), we obtain the following re urren e equation over
rational fun tions:
1 = r(n + 1)rat t(n) r(n)
where ratt (n) := t(n + 1)=t(n). Gosper ould not solve this kind of re urren e
equations, whi h today an be solved by Abramov's method.[Abr95 For an alternative approa h and a detailed explanation of the onne tion between these
strategies see, for instan e, [Pau95. Gosper had to nd a way to get round this
problem: he rewrites rat t in a spe ial form (See (1.2) in Algorithm 1.1) that leads
to a simpler linear re urren e equation in whi h the unknown is a polynomial,
and that an be solved by simple linear algebra.
1.3.2 Zeilberger's Algorithm

Zeilberger's algorithm solves the de nite hypergeometri summation problem:


given a proper hypergeometri term F (n; k) with natural boundary, (i.e. for any
xed n, F (n; k) has nite support with respe t to k), it nds a k-free re urren e
for F (n; k) of the form: Pmi=0 ai(n)F (n + i; k) = G(n; k + 1) G(n; k), whi h
under the ondition of natural boundary
for F (n; k) yields a homogeneous linear
Pn
re urren e for the sum f (n) = k=0 F (n; k). See Algorithm 1.2 for the pseudo ode.

18

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

Algorithm 1.2 Zeilberger's Algorithm


Input: A hypergeometri term F (n; k) in n and k over a eld K
Output:

of hara ter-

isti 0.
A k-free linear re urren e with polynomial oe ients for F (n; k) of the
form:
m
X
ai (n)F (n + i; k) = G(n; k + 1) G(n; k)
(1.4)
i=0

1:
2:
3:
4:
5:
6:

Try Gosper's algorithm, on F (n; k);


if it nds a solution then
return this solution;
m := 1;
while no solution yet do
Try the modi ed version of Gosper's algorithm on the term
m
X
i=0

7:
8:
9:
10:

ai (n)F (n; k)

in whi h the ai 's are polynomial unknowns.


if some polynomials ai 's and a hypergeometri term G(n; k) an be found
for whi h the above re urren e (1.4) is satis ed then
return [G; [a0 ; : : : ; am
else
m := m + 1;

1.4.

19

THE IMPLEMENTATION

The modi ed version of Gosper's algorithm is formally the same


as the standard one; the only di eren e is that in this version the ai 's appear
as polynomial parameters and the solving of the re urren e equation p(n) =
q (n)s(n + 1) r(n)s(n) is now done by plugging in unknown polynomials whose
oe ients are no more in the ground eld K , but in the ring of rational fun tions
with oe ients in K .
Therefore the problem of de nite summation an be rewritten as the problem of
solving systems of linear equations with polynomial oe ients.
Remark 1.3.4. Under the hypothesis of natural boundary ( nite support) of
F (n; k), for instan e let us assume that the support is stri tly ontained in the
interval
[0; p, with p > 0, the spe ial re urren e for the summand F (n; k), namely
Pm
i=0 ai (n)F (n + i; k ) = G(n; k +1) G(n; k ) leads to a (homogeneous) re urren e
for the sum f (n), whi h is what we are ultimately looking for.
In fa t, summing the left hand side and right hand side of the spe ial re urren e
over a boundary larger than the support of F (n; k) we get:
Remark 1.3.3.

p X
m
X
k=0 i=0

ai (n)F (n + i; k) =

Hen e:

n
X
i=0

p
X
k=0

(G(n; k + 1)

G(n; k)) = G(n; p + 1) G(n; 0) = 0

f (n + i) = G(n; p + 1) G(n; 0) = 0

When the summand does not have nite support the above equation will be
non-homogeneous.
Why it works

For a formal proof of the orre tness we refer to the literature on this topi
([PWZ97, [Zei90, [Zei91, [S h95). Here we present the basi idea behind it.
From Theorem 1.2.3 that states the existen e of a k-free re urren e (see Se tion 1.2.2) we know that forPany
proper hypergeometri term F (n; k), there exists
a re urren e of the form: mi=0 ai (n)F (n + i; k) = G(n; k + 1) G(n; k). Zeilberger's algorithm tries to nd this re urren e by iteratively in reasing the order
of the re urren e and by using a modi ed version of Gosper's algorithm to nd
its right hand side; this pro edure stops be ause of the termination of Gosper's
algorithm and be ause of the theorem mentioned above.

1.4 The Implementation


In this se tion we report on some of the details of our implementation of Zeil-

berger's fast algorithm and of Gosper's algorithm.

20

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

The implementation of these two algorithms has been done in the internal
LISP-like language of the Ma syma and Maxima omputer algebra systems.
I implemented both algorithms in Ma syma in a straightforward way and no
signi ant hanges have been made in the original algorithms.
1.4.1 Gosper's Algorithm

My implementation of Gosper's algorithm works in the spe ial ase of proper


hypergeometri terms, but it an be easily extended to the general hypergeometri
ase by substituting the Gosper form related routine with a more general routine
in whi h the Gosper form is a hieved by a resultant omputation. (See [GKP94
for more details).
As a onsequen e of this implementation hoi e the desired spe ial form at
step 1 for the rational fun tion ratt (n) is onstru ted by initializing p(n) := 1,
q (n) := numerator(ratt ), r(n+1) := denominator(ratt ) and by simple inspe tion
and rewriting of the fa tors of the polynomials q and r (See Algorithm 4.1 for
more details).
1.4.2 Zeilberger's Fast Algorithm

This version of Zeilberger's algorithm works in the proper hypergeometri ase. It


was onje tured that Zeilberger's algorithm ould have worked on a larger lass of
terms, namely the lass of holonomi terms (see [Chy98) but it has been proved
that the lass of proper hypergeometri terms and holonomi terms oin ide (see
[APb, [APa).
The omputation of the re urren e for the sum and its solution is left to the
user as a post-pro essing. Moreover the existen e of a solution expressible in
elementary terms is not always guaranteed, therefore leaving the solution as a
re urren e is a reasonable hoi e.

1.5 Performan e
First of all we must point out that this implementation is only the rst attempt to
in orporate Zeilberger's fast algorithm into the Ma syma and Maxima omputer
algebra systems and therefore it is very far from being ompetitive with the best
existing optimized implementations (for example see [PS95).
No large s ale test has been arried out to assess the speed of this implementation. The only test that has been run on this implementation is the olle tion
of terms ontained in the les testGosper.ma syma and testZeilberger.ma syma, among whi h there are some powers of the binomial oe ient. In reasing
powers of the binomial oe ients have been used to test the stability of the system and to obtain a rough idea of the performan e of the system and to ompare

1.5.

PERFORMANCE

21

it to some other implementations. I used this test suite be ause of its simpli ity
andpbe ause we know a priori that the order of the re urren e for the summand
is d 2 e, where p is the power. (see [Cus89).
1.5.1 Timings

We present some timings obtained by testing the fun tion parGosper on in reasing powers of the binomial oe ients in whi h no loop on the order of the
re urren e is run. In these tests the Paule-S horn Mathemati a implementation
[PS95 and our Ma syma implementation are ompared. These implementations
have been tested on an SGI O tane with 2 gigabytes of RAM and two 250 Mhz
RISC pro essors (although mu h less memory was ne essary to run the programs
on these examples).
Results
Note: Timings are in se onds
power
order Paule=S hornMathemati a Ma syma Ratio
3
2
0:36s
3:31s 9:19
4
2
0:92s
3:95s 4:29
5
3
4:47s
37:11s 8:30
6
3
16:98s
121:64s 7:16
Average ratio :
7:23
1.5.2 Stability

Our Ma syma implementation tested on an SGI O tane equipped with 2 gigabytes of RAM ould no go beyond the sixth power of the binomial oe ient whereas Paule-S horn Mathemati a implementation was able to handle the
eleventh power. The sixth power of the binomial oe ient required less than 50
megabytes of memory.
1.5.3 Future Improvements

An analysis on the distribution of the omputation time shows that in the \heavy
ases" (binomial oe ient to the fth and sixth powers) the bottle-ne k is the
omputation of the solution of the linear systems of equations that is required to
solve the re urren e equation (Gosper's equation).
This version uses the built-in linear solver of Ma syma and Maxima, whereas
Paule-S horn Mathemati a uses a spe ial linear solver tailored for sparse systems.
Future optimized versions should use an ad ho linear solver that ould take
advantage of the spe i stru ture of the system.

22

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

1.6 Manual
Now we des ribe how to load and use the pa kage.
1.6.1 Loading the les

The entire pa kage an be downloaded from the RISC ombinatori s home page
at the following URL http://www.ris .uni-linz.a .at/resear h/ ombinat/ris /
The user will nd the following les:
1. algUtil.ma syma
2. shiftQuotient.ma syma
3. poly2quint.ma syma
4. makeGosperForm.ma syma
5. GosperEq.ma syma
6. Gosper.ma syma
7. Zeilberger.ma syma
8. LOADZeilberger.ma syma
9. testZeilberger.ma syma
10. testGosper.ma syma
The entire pa kage an be loaded into memory by simply loading the le
LOADZeilberger.ma syma; this le will take are of loading the other omponents
ex ept the les ontaining some examples on whi h the system has been tested,
namely testZeilberger.ma syma and testGosper.ma syma.
1.6.2 The Commands

Both Gosper and Zeilberger's algorithm have been implemented in two versions:
a verbose version, whi h allows the user to hoose di erent levels of verbosity,
and a non-verbose version.

1.6.

23

MANUAL

Verbosity

The levels of verbosity are sele ted by the user just appending a sux to the
ommand name (Gosper, parGosper, Zeilberger) or by passing a parameter in
the generi verbose versions of the ommand, whi h is obtained by appending the
sux VerboseOpt to the ommand name. No sux is interpreted as non-verbose.
These are the levels of verbosity that have been implemented in both algorithms:
Level

Sux

summary
normal
very
debugging

Summary
Verbose
VeryVerbose
Debugging

linsys

LinSys

Example 1.6.1.

GosperVerbose(f,k)

S ope

summary of the main omputations


verbosity on the main pro edure
verbosity on the subroutines
strongest verbosity
verbosity on the linear system

invokes Gosper's algorithm in verbose mode.

Example 1.6.2.

ZeilbergerVeryVerbose(f,k,n)

bose mode.

invokes Zeilberger's algorithm in the very ver-

Gosper's Algorithm

Gosper(f,k)

It solves the inde nite summation problem of nding a hypergeometri term


g (k) su h that f (k) = k g (k) = g (k + 1) g (k). If su h a hypergeometri
term exists it returns it as output, otherwise it will return NO HYP SOL.

GosperVerboseOpt(f,k,verbosity)

GosperSum(f, k, a, b)

As Gosper but the level of verbosity is passed as a parameter.

It omputes Pbk=a f by using Gosper to solve the inde nite sum. (It only
works if the inde nite sum is Gosper-summable).
GosperSumVerboseOpt(f, k, a, b, verbosity)

As GosperSum but the level of verbosity is passed as a parameter.

24

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

Zeilberger's Fast Algorithm

Zeilberger(F, k, n)

Given a 2-variable proper hypergeometri term F (n; k), it omputes by


Zeilberger's algorithm a re urren e equation for F of the form:
d
X
i=0

ai (n)F (n + i; k) = k (Cert(n; k)F (n; k));

(1.5)

where the ai's are polynomials free of k and Cert (\rational erti ate")
is a rational fun tion in n and k. The output will be a print-out of the
re urren e and the expli it values of the polynomial parameters ai and the
\rational erti ate" Cert(n; k).



ZeilbergerVerboseOpt(F, k, n, verbosity)

As Zeilberger but the level of verbosity is passed as a parameter.


parGosper(F, k, n, d)

Given a 2-variable proper hypergeometri term, it omputes, when it exists,


a re urren e equation of order d for F of the form:
d
X
i=0

ai (n)F (n + i; k) = k (R(n; k)F (n; k));

(1.6)

where ai's are polynomials and R is a rational fun tion (the erti ate), and
it yields a term [R; [a0 ; : : : ; ad ; if no su h re urren e exists them it yields
[0; [dummy value; : : : ; dummy value.


parGosperVerboseOpt(F, k, n, d, verbosity)

As parGosper but the level of verbosity is passed as a parameter.

Settings

The only setting is the environment variable MAX ORD that sets an a priori bound
on the order of the re urren e that Zeilberger's algorithm iteratively tries to nd
by applying parGosper with in reasing order. The default value of MAX ORD is 3.

1.7 Some Examples


Let us take a look at some examples, that an be found in the les
 testGosper.ma syma

1.7.

25

SOME EXAMPLES

testZeilberger.ma syma.

A simple1 Gosper-summable example


Let us try to teles ope 4k 1 by Gosper's algorithm:
Example 1.7.1.

(prompt) Gosper(1/4*k^2-1,k);
output: 2(2k1 1)

Let us now try to sum it over the interval [1; 4, i.e. evaluate P4k=1 4k 1 1

(prompt) GosperSum(1/4*k^2-1, k, 1, 4);


output: 94

A less simple
Gosper-summable example
( 1)k k
Let us try to teles ope 4k 1 by Gosper's algorithm:
Example 1.7.2.

(prompt) Gosper(((-1)^k*k)/(4k^2-1),k);
k
output: 4(2( k1) 1)

Example 1.7.3. An example involving fa torials


(prompt) Gosper((a!*(-1)^k)/((a-k)!*k!),k);
k
output: aa(!ak( k1))!k!

Example 1.7.4. A non-Gosper-summable ase


(prompt) Gosper(binomial(n,k),k,n);
output: NO HYP SOL

To handle this we must use parGosper or Zeilberger as shown in the next


example.
Example 1.7.5.
oe ient

Pm Binomial
n
To evaluate i=0 k we an use Zeilberger or parGosper and use the fa t that
we expe t a rst order re urren e:
(prompt) Zeilberger(binomial(n,k),k,n);
output:

where

a[0f (n; k) + a[1f (n + 1; k) = k (Cert(n; k)f (n; k))


f (n; k) =

and
Cert(n; k) =

 

n
k

k
n k+1

26

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

and
a[0(n) = 2
a[1(n) = 1

Summing both sides of the re urren e and omputing the sum is left as simple
post-pro essing.
Assuming that the re urren e has order 1, we ould have used parGosper:
(prompt) parGosper(binomial(n,k),k,n,1);
output:


k
;f
n k+1

2; 1g

Squared binomial oe ient


We an try to sum the squared binomial oe ient with parGosper, but to do
this we must guess the order of the re urren e:
Example 1.7.6.

(prompt) parGosper(binomial(n,k)^2,k,n,1);
output:


k2

(3 n 2 k + 3) ; f 2 (2 n + 1) ; n + 1g
(n k + 1)2

Binomial Theorem
Let us try a similar example:

Example 1.7.7.

(prompt) Zeilberger(binomial(n,k)*x^k,k,n);
output:
a[0f (n; k) + a[1f (n + 1; k) = k (Cert(n; k)f (n; k))

where

f (n; k) =

and
and

Cert(n; k) =

 

n k
x
k

k
n k+1

a[0(n) = (x + 1)
a[1(n) = 1

1.7.

27

SOME EXAMPLES

Example 1.7.8. Vandermonde identity re urren e (see [GKP94, page 169)


(prompt) Zeilberger(binomial(a,k)*binomial(b,n-k),k,n);
output:

where

a[0f (n; k) + a[1f (n + 1; k) = k (Cert(n; k)f (n; k))


f (n; k) =

 

a
k

and
Cert(n; k) =

and

n k

k( n + k + b)
n k+1

a[0(n) = (n b a)
a[1(n) = (n + 1)
Example 1.7.9.
(prompt)

First Karlsson-Gosper identity (see [Kar86)

Zeilberger(binomial(n,k)*(n-1/4)!/(n-k-1/4)!/
(2*n+k +1/4)!*9^(-k),k,n);

output:

where

a[0f (n; k) + a[1f (n + 1; k) = k (Cert(n; k)f (n; k))


f (n; k) =

and
Cert(n; k) =

and

9k (n

(n

)! nk
1
1
4 )!(2n + k + 4 )!
1
4

144k(8n + 4(k 1) + 13)(52n2 + 16kn + 75n 32k2 + 24k + 26


(n k + 1)(4n 4k + 3)(8n + 4k + 5)(8n + 4k + 9)
a[1(n) =

a[0(n) = 28
27(3n + 2)(12n + 13)

28

CHAPTER 1.

Example 1.7.10.
(prompt)

ZEILBERGER'S ALGORITHM IN MACSYMA

Se ond Karlsson-Gosper identity (see [Kar86)

Zeilberger(binomial(n,k)*(n-1/4)!/(n-k-1/4)!/
(2*n+k+5/4)!*9^(-k),k,n);

output:

where

a[0f (n; k) + a[1f (n + 1; k) = k (Cert(n; k)f (n; k))


f (n; k) =

and
Cert(n; k) =

and

9k (n

(n

)! nk
5
1
4 )!(2n + k + 4 )!
1
4

144k(8n + 4(k 1) + 17)(52n2 + 16kn + 127n 32k2 4k + 72)


(n k 1)(4n 4k + 3)(8n + 4k + 9)(8n + 4k + 13)
a[1(n) =

a[0(n) = 28
27(3n + 4)(12n + 17)

Example 1.7.11. Trinomial oe ients


(prompt) Zeilberger(n!/k!/(k+m)!/(-2*k-m+n)!,k,n);
output:
a[0f (n; k) + a[1f (n + 1; k) + a[2f (n + 2; k) = k (Cert(n; k)f (n; k))

where

f (n; k) =

and
Cert(n; k) =

and

(n

n!
k!(n + k)!(n m

2k)!

4k(m + k)(n + 1)(n + 2)


m 2k + 1)(n m 2k + 2)

a[0(n) = 3(n + 1)(n + 2)


a[1(n) = (n + 2)(2n + 3)
a[2(n) = (n m + 2)(n + m + 2)

1.7.

29

SOME EXAMPLES

Example 1.7.12. Spe ial ase of the Strehl identity (see [Str94a)
(prompt) Zeilberger(binomial(2*k,k)*binomial(n,k)^2,k,n);
output:
a[0f (n; k) + a[1f (n + 1; k) + a[2f (n + 2; k) = k (Cert(n; k)f (n; k))

where
Cert(n; k) =

and

k3 (n + 1)2 (4n 3k + 8)
(n k + 1)2(n k + 2)2

a[0(n) = 9(n + 1)2


a[1(n) = (10n2 + 30n + 23)
a[2(n) = (n + 2)2
Example 1.7.13. Another se ond order re urren e
(prompt) Zeilberger((n!*(n+k)!)/(k!^3*(n-k)!^2),k,n));
output:
a[0f (n; k) + a[1f (n + 1; k) + a[2f (n + 2; k)+a[3f (n + 3; k) =
k (Cert(n; k)f (n; k))

where
f (n; k) =

and
Cert(n; k) =

and

n!(n + k)!
k!3 (n k)!2

k3 (n + 1)(11n2 6kn + 37n k2 7k + 30)


(n k + 1)2(n k + 2)2
a[0(n) = (n + 1)2
a[1(n) = (11n2 + 33n + 25)
a[2(n) = (n + 2)2

(1.7)

30

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

The binomial oe ient to the third power


We an also use parGosper to nd a re urren e on su h sequen e, but we must
guess its order:
Example 1.7.14.

(prompt) parGosper(binomial(n,k)^3,k,n,1);
output: f0; f0; 0gg

This means that parGosper ould not nd a rst order re urren e of the desired
form but we don't give up. Let us look for a se ond order re urren e:

(prompt) parGosper(binomial(n,k)^3,k,n,2);
output:


(k3 (n + 1)2 14n3 27 kn2 + 74n2 + 18k2n


93kn + 128 n 4k3 + 30k2 78k + 72 )=
((
n k + 1)3 (n k + 2)3 );

8 (n + 1)2 ; 7n2 + 21 n + 16; (n + 2)2

(1.8)

Example 1.7.15. Binomial oe ient to the fourth power


(prompt) Zeilberger(binomial(n,k)^4,k,n);
output:
a[0f (n; k) + a[1f (n + 1; k) + a[2f (n + 2; k) = k (Cert(n; k)f (n; k))

where
f (n; k) =

and

 4

n
k

Cert(n; k) =
k4 (n + 1)(74n6 260kn5 + 725n5 + 374k2 n4 2056kn4 + 2885n4
276k3n3 6420kn3 + 6045n3 + 104k4n2 1244k3n2 + 5298k2n2
9892kn2 + 7030n2 16k5n + 298k4n 1884k3 + 5322k2n 7520kn+
4300n 20k5 + 210k4 900k3 + 1980k2 2256k + 1080
=
(n k + 1)4(n k + 2)4

(1.9)

and

1.8.

31

THE CODE

a[0(n) =

4(n + 1)(4n + 3)(4n + 5)


a[1(n) = 2(2n + 3)(3n2 + 9n + 7)
a[2(n) = (n + 2)3

1.8 The Code


The implementations of both Gosper's algorithm and Zeilberger's fast algorithm
have been entirely oded in the internal LISP-like language of the omputer algebra systems Ma syma vers.419 and Maxima 5.5. The implementation exploits
Ma syma omputer algebra engine for fa torizing, simplifying and normalizing
polynomials and rational fun tions, and the modularity of the Ma syma language,
but it does not use Ma syma hypergeometri tools like Gosper's implementation
of his own algorithm be ause Zeilberger's algorithm requires a parametrized version of Gosper's algorithm.
The entire ode an be found in the RISC ombinatori s home page at the
U.R.L.: http://www.ris .uni-linz.a .at/resear h/ ombinat/ris /.
The ode is ontained in the following les:
algUtil.ma syma
shiftQuotient.ma syma
poly2quint.ma syma
makeGosperForm.ma syma
GosperEq.ma syma
Gosper.ma syma
Zeilberger.ma syma
LOADZeilberger.ma syma
testZeilberger.ma syma
testGosper.ma syma

algebrai utilities
shift quotient omputation
internal data stru tures onversions
Gosper form related routines
Gosper equation related routines
Gosper's algorithm main routines
Zeilberger's algorithm main routines
Zeilberger's routines loader
Some examples
Some Gosper's algorithm related examples

1.8.1 Low Level Routines

The low level routines are ontained in the les algUtil.ma syma, shiftQuotient.ma syma and poly2quint.ma syma.
The rst le ontains the lowest level algebrai routines for handling polynomials (extra ting omponents of polynomials, degree, et ).

32

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

The se ond le ontains routines ne essary for omputing the shift quotient of
a hypergeometri term and for omputing the result of the appli ation of a linear
re urren e operator to a hypergeometri term, whi h is omputed by a strategy
similar to the one used in Horner's algorithm for polynomial evaluation:
ni eForm(hyp,var,parName,ord) :=
blo k(
[shQuo,num,den,res,
res:parName[ord,
shQuo : shiftQuo(hyp,n),
for i : ord step -1 thru 1 do
res : xthru(parName[i-1 +
shiftFa tPoly(shQuo,n,i-1)*res),
return(res)
);

The third le ontains the routines ne essary for storing polynomials in spe ial
data stru tures; namely quintuples that are well-suited for building the desired
Gosper form of the shift quotient of a proper hypergeometri term. Su h quintuples are arrays in whi h the following information of a polynomial is stored:
 degree
 leading oe ient
 se ond leading oe ient
 tail (polynomial without the rst two monomials)
 multipli ity (number of o urren es) of the polynomial in the shift quotient
Example 1.8.1.

If the polynomial (7x3 5x2 + 4x + 8) appears in the shift quotient with a


multipli ity, say 5, it will be en oded in the following quintuple : [3; 7; 5; x2 +
4x; 5.
1.8.2 Gosper Form Routines

All the Gosper form (1.2) related routines are in makeGosperForm.ma syma. The
main routine builds the desired form by he king iteratively the g d ondition
required by the Gosper form. Whenever the ondition is violated the undesired
fa tors will be moved from the polynomials q and r to the polynomial p. This
pro edure exploits the ad ho data stru ture quintuple, whi h has been oded
in poly2quint.ma syma. A detailed des ription of this pro ess is treated in
Chapter 4.

1.8.

THE CODE

33

1.8.3 Gosper Equation Routines

The omputation of the degree of the solution and the solution of the Gosper
equation (1.3) has been oded in the le GosperEq.ma syma. Solving is done by
simple linear algebra on the unknown oe ients of the solution.
1.8.4 Gosper's and Zeilberger's Algorithm

Gosper's and Zeilberger's algorithm have been oded in two versions (verbose
and non-verbose) in the le Gosper.ma syma.
Zeilberger's fast algorithm is a parametrized version of Gosper's algorithm,
in whi h the linear solving of the re urren e equation is done with polynomial
parameters.
The oding follows in a straightforward way Gosper's algorithm as des ribed
in the previous se tions.

34

CHAPTER 1.

ZEILBERGER'S ALGORITHM IN MACSYMA

Part II
Solving Systems of Linear
Equations by Interpolation

35

Chapter 2
Cramer Driven Interpolation

2.1 Introdu tion


We des ribe an algorithm based on Cramer's rule and on polynomial interpolation
that solves overdetermined systems of homogeneous linear equations over Q and
over the eld of rational fun tions over Q under the hypothesis that the null spa e
has dimension 1. We restri t our attention to the ase of overdetermined systems
with one-dimensional null spa e be ause they are easier to study and be ause
the systems involved in hypegeometri summation are very often of the same
type. The algorithm des ribed is a generalization of the algorithm in [Lip81,
pages 243{251. The algorithm omputes the numerators and denominators of
the omponents of the solutions as determined by Cramer's rule. It does so by
rst omputing homomorphi systems over nite elds Zp, with p prime and then
by polynomial interpolation or by the Chinese remainder theorem.

2.2 Notation
In the following K will be a eld ontaining Q and A an m  n matrix with
entries over K , with m  n.
Let us denote the entries of A with ai;j , for 1  i  m and 1  j  n, i.e.
0

A=

De nition 2.2.1.

B
B
B
B


a1;1 a1;2    a1;n


a2;1 a2;2    a2;n
:::::::::::::::::::::
:::::::::::::::::::::
am;1 am;2    am;n

1
C
C
C:
C
A

(2.1)

We de ne the the largest square upper part of A, denoted by


37

38

CHAPTER 2.

A, as the matrix:

A=

B
B
B
B


CRAMER DRIVEN INTERPOLATION

a1;1 a1;2    a1;n


a2;1 a2;2    a2;n
:::::::::::::::::::
:::::::::::::::::::
an;1 an;2    an;n

1
C
C
C:
C
A

(2.2)

For any given m  s matrix M and any olumn ve tor b with s entries, we
denote by M jb the m  (s + 1) matrix obtained by appending the ve tor b to M .
De nition 2.2.2. We de ne by L(A) the matrix obtained from A by removing
its last olumn and by R(A) the last olumn of A.
In the following we will refer to Gaussian elimination applied on a matrix as
to any pro ess that produ es a (lower or upper) triangular matrix by operations
that do not hange the solutions of the orresponding system of linear equations.
In pra ti e when using homomorphi images the hoi e of the matrix should be
done in a way that makes it very likely to have images that an be used for
re onstru ting the solutions of the system (see Remark 2.4.2).
De nition 2.2.3. For any matrix M we de ne the triangular form of M , denoted
by  (M ), to be the matrix obtained from M by performing Gaussian elimination
on it.
De nition 2.2.4. Given a matrix M 2 K m;s and a olumn ve tor with m omponents, we all the i-th Cramer matrix of M with respe t to b, denoted by
Ci (M; b), the matrix obtained from M by substituting the i-th olumn with b,
for 1  i  s.
Example 2.2.1.

Let us onsider
Then

0 1
2 4 51
6
A =  7 0 3 A; b =  2 A
1 1 2
0

0 1
2 41
5

A

L(A) = 7 0 ; R(A) = 3 A ;
1 1
2

6 4 51
C1 (A; b) =  2 0 3 A :
0 1 2

(2.3)

(2.4)

2.3 The Homogeneous Problem


We onsider the problem of solving the homogeneous system of linear equations

2.4.

39

RATIONAL COEFFICIENTS

Ax = 0;

(2.5)

with A 2 K m;n, m  n and when the dimension of the null spa e of A is 1.


Let us denote L(A) by A0 and let us assume without loss of generality that
A0 has maximal rank, i.e. n 1. Sin e the null spa e of A has dimension 1, then
A has rank n 1 and we an set the value of the last omponent of the solution
to (2.5) to 1 and onsider the problem:
A0 x = b;

(2.6)
where b is a olumn ve tor obtained by taking the opposite of the last olumn of
A, i.e. its omponent i-th omponent is ai;n , for all 1  i  m.
A solution to (2.6) gives us the remaining n 1 omponents of the solution
to (2.5) whose last omponent is 1. All the other solutions will be multiples.
We now fa e the problem of solving an overdetermined system of inhomogeneous linear equations of maximal rank.

2.4 Rational Coe ients


We denote by m a positive integer and by r a non-negative integer.
We onsider the problem of nding the integers x su h that
with

xr

mod m;

(2.7)

0  r < m:
(2.8)
We onsider an elementary result1 whi h tells us how to re over an integer
solution from a modular one.
De nition 2.4.1.

For any r su h that 0  r < m, we de ne m(r) as follows:


m (r) =

1 For

r;
r m;

if r < m=2,
otherwise.

(2.9)

a more detailed study of the solutions to integer ongruen es we refer to [Lip81, pages
243{251.

40

CHAPTER 2.

Theorem 2.4.1. The ongruen e


xr
with
has a unique solution s, su h that
given by s = m (r).

CRAMER DRIVEN INTERPOLATION

mod m;

0r<m

m=2  s < m=2;

(2.10)
(2.11)
(2.12)

Clearly the de nition of m (r) (2.9) gives a solution in the desired range.
Let us now denote by s1 and s2 two solutions of (2.10) in the range given by (2.11).
Therefore we have
s1  s2 mod m:
(2.13)
If they were not equal, we ould assume, without loss of generality, 0  s1 <
s2 < m and therefore we would have
0 < s2 s1 < m;
(2.14)
but then, by (2.13), we would also have that s2 s1 is a multiple of m, whi h
ontradi ts (2.14).

Remark 2.4.1. The fun tion m des ribes the least positive solution to the
ongruen e (2.10). Su h a fun tion is ne essary when re onstru ting possibly
negative integer solutions for whi h only a bound on the absolute value is known.
Proof.

2.4.1 De nitions

Now let us assume that the eld K is the eld Q of the rational numbers.
For a given matrix M 2 Q m;n with m  n and a given prime p su h that
it does not divide any of the denominators of the entries of M , we denote by
modp(M ) the matrix obtained from M by taking its entries modulo p.
In the following we will always onsider primes that do not divide any of the
denominators of the entries in the onsidered matrix.
We onsider those primes p su h that, for 1  i  n
det(L( (p) )) 6= 0;
det(L( (p) )) = modp(det(L( )));
det(Ci(L( (p) ); R( (p) ))) = modp(det(Ci(L( ); R( ))));

(2.15)

2.4.

41

RATIONAL COEFFICIENTS

where

 =  (M );
 (p) =  (modp (M )):

(2.16)

We all su h primes \lu ky" for M .


Remark 2.4.2. The lu kiness of a prime does not only depend on M but also
on  . In order to redu e the risk of having \unlu ky" hoi es, it is better to
perform Gaussian elimination by only allowing addition to a row of a s alar
multiple of some other row and inter hange of two rows and by keeping some
history of the row swit hes in order to later he k whether a prime was probably
\lu ky".

2.4.2 Modular Approa h

We an solve the overdetermined system of linear equations of maximal rank (2.6)


by a modular approa h, namely by onsidering modular homomorphisms.
Let us denote  (A0jb) by  and  (modpj (A0jb)) by  (pj ) . Q
We onsider a set of primes fp1 ; : : : ; pl g su h that B < li=1 pi, where B is a
known bound su h that
B > 2 max(jdj; jd1j; : : : ; jdn 1j);
(2.17)
where
d = det(L( ));
(2.18)
di = det(Ci (L( ); R( ))):
For ea h of the primes pj we ompute
d(pj ) = det(L( (pj ) ));
(2.19)
d(ipj ) = det(Ci (L( (pj ) ); R( (pj ) ))):
An e ient way to ompute d(pj ) in (2.19) is to rst ompute  (pj ) and then
ompute the determinant of(pits) upper part as the produ t of the diagonal elements. The determinants di j an be omputed by solving the triangularized
system  (modpj (A0jb)) by ba k-substitution and taking, for ea h omputed omponent of the solution, the produ t by d(pj ) .
In fa t if pj is lu ky, then by Cramer's rule we have
(pj )

xi

di(pj )
;
d(pj )

1  i  n 1;

(2.20)

42

CHAPTER 2.

CRAMER DRIVEN INTERPOLATION

where xpi j is the i-th omponent of the solution modulo pj of the system orresponding to modpj (A0jb).
Moreover, if the primes pj are lu ky for A0 jb, then by (2.15), we must also
have:
d(pj )  d

mod pj ;

(2.21)

d(ipj )  di

mod pj ;

(2.22)

z  d(pj )

mod pj 1  j  l;

(2.23)

zi  di(pj )

mod pj 1  j  l;

(2.24)

and

for 1  j  l and 1  i  n 1.
We now onsider the following Chinese remainder problems:
and

for 1  i  n 1.
By the Chinese remainder theorem (see [Win96 and Appendix A) we an
solve the systems of ongruen es (2.23) and (2.24). Therefore
Ql we would nd a


non-negative integer solution d to (2.23) with 0  dQi < j=1 pj and the nonnegative integer solutions di to (2.24) with 0  di < lj=1 pj .
We onsider the system of ongruen es
y  d

with

and

l
Y
j =1

l
Y
j =1

j =1

j =1

mod

j =1

l
Y
j =1

pj ) =2;

(2.26)
(2.27)

pj ;

l
Y

pj )=2  yi < (

(2.25)

pj ;

l
Y

for 1  i  n 1.
We noti e that by (2.17) we have
l
Y

l
Y

pj ) =2  y < (

yi  di

with

mod

j =1

pj ) =2

pj  B > 2 max(jdj; jd1j;    ; jdn

(2.28)

j);

(2.29)

2.4.

43

RATIONAL COEFFICIENTS

and that d and di are solutions respe tively of (2.25) and (2.27). Therefore
Theorem 2.4.1 guarantees the existen e and uniqueness of the solution to (2.25)
and (2.27) whi h must then be respe tively d and di.
The omponents of the solution to (2.6) are obtained by Cramer's rule.
Example 2.4.1.

Let us onsider the simple example


0 1
0
3
2 3 51
C
B
B 1 1
4 C; b = B 2 C
C
(2.30)
A=B
 2 A:
 4
2 3 A
5
3 4 9
We know with hindsight that 89 is a big enough prime to re onstru t the
omponents of solution of the matrix orre tly, i.e. we know that
89 > 2  max(jdj; jy1j; jy2j; jy3j);
(2.31)
where d is the determinant of A and yi is the determinant of Ci(A; b), i.e. the
i-th Cramer of A with respe t to b.
Then performing Gaussian elimination on mod89(Ajb) over Z89 produ es:
0

2
B 1
mod89(Ajb) = B
 4
3

3
1
87
4

84
85
3
8

31
2C
C
2A
5

2
B 0
B
 0
0

3
46
81
44

84
62
13
43

3 1
46 C
C
85 A
45

(2.32)

2 3 84 3 1 0 2 3 84 3 1
B 0 46 62 46 C
B 0 46 62 46 C
B
C
C
B
 0 0 47 4 A :
 0 0 47 4 A
0 0 34 1
0 0 0 0
By ba k-substitution in Z89 we get
x1 = 32; x2 = 12; x3 = 55:
(2.33)
The determinant in Z89 is given the produ t of the diagonal elements:
d0 = mod89 (det(A)) = 52:
(2.34)
Using Cramer's rule (2.20) we get that the numerators in Z89 of the omponents of the solution are:
y^1 = x1  d0 = 32  52  62
mod 89;
(2.35)
0
y^2 = x2  d = 12  52  1
mod 89;
(2.36)
y^3 = x3  d0 = 55  52  12
mod 89:
(2.37)
(2.38)
0

44

CHAPTER 2.

CRAMER DRIVEN INTERPOLATION

In order to re onstru t the determinants in Z we take the least absolute value


integer (2.9):
d = 89 (d0 ) = 52 89 = 37;
y1 = 89 (y10 ) = 62 89 = 27;
(2.39)
y2 = 89 (y20 ) = 1;
y3 = 89 (y30 ) = 12:
The solution in Q will then be:
(y1=d; y2=d; y3=d) = (27=37; 1=37; 12=37):

(2.40)

2.4.3 Bounding the Solutions


Unless a good bound for jdj, jd1j; jd2j; : : : ; jdn 1j is known be ause of extra infor-

mation about the spe i problem, a reasonable bound for the absolute value of
the determinant is given in most ases by the Hadamard bound.
De nition 2.4.2. For a given matrix A 2 Q n;n , the Hadamard bound, denoted
by H (A), for the absolute value of the determinant of A is given by
H (A) =

n
Y

jjAijj2;

(2.41)

1 2 ;
3 5

(2.42)

i=1

where Ai is the i-th row in A.


Example 2.4.2.

For the matrix

A=

we have
det(A) = 11; H (A) = jj( 1; 2)jj2  jj(3; 5)jj2 = (1 + 4)1=2  (9 + 25)1=2 ' 11:66:
(2.43)
Remark 2.4.3. Sin e for any matrix A we have jAj = jAT j, we an get a sharper
bound by taking the minimum of the Hadamard bounds for both the matrix and
its transpose.
For a re tangular matrix A 2 Q m;n , with m > n a bound is obtained by taking
the maximum of the Hadamard bounds for all possible minors of size n  n.

2.5.

RATIONAL FUNCTIONS

45

2.5 Rational Fun tions


In the following se tion we present our way of adapting the results presented in
the previous se tion to the rational fun tion ase.
2.5.1 De nitions

Let us now onsider the ase when the eld K is the eld Q (y) of univariate
rational fun tions over the rationals.
The notations evalx(M ) and A(x), with x 2 Q and su h that it is not a root
of any of the denominators of the entries of M , denote the matrix obtained from
M by substituting y by x.
In the following we will always onsider rational values x su h that they do
not divide any of the denominators of the entries of the onsidered matrix.
For any given matrix A we onsider the evaluation homomorphisms with
respe t to the upper determinant of the triangular form, obtained by substituting
the variable with rational values. We onsider the rationals x su h that, for
1  i  n, the following holds:
det(L(x )) 6= 0;
det(L(x )) = evalx(det(L( )));
det(Ci(L(x ); R(x))) = evalx(det(Ci(L( ); R( ))));
where we have used the following abbreviations
 :=  (M );
x :=  (M (x)):
We all \lu ky" those rationals x for whi h (2.44) holds.
2.5.2 Interpolation

(2.44)
(2.45)

Analogously to the ase for K = Q we an solve the overdetermined system of


linear equations of maximal rank (2.6) by interpolation.
We onsider s distin t rationals x1 ; : : : ; xs, with s su h that D < s, where D
is a known bound su h that
D > max(deg(d); deg(d1 ); : : : ; deg(dn 1 ));
(2.46)
where, as in the ase K = Q ,
 =  (A0 jb);
d = det(L( ));
(2.47)
di = det(C (L( ); R( ))):

46

CHAPTER 2.

CRAMER DRIVEN INTERPOLATION

For ea h evaluation we ompute the orresponding upper determinants.


In order to ombine the solutions orresponding to di erent evaluations we
use polynomial interpolation (e.g. Lagrange polynomial interpolation, Newton
polynomial interpolation, et .). Choosing lu ky evaluations guarantees a orre t
result. For the de nition of Lagrange and Newton polynomial interpolation we
refer to Appendix A.
This approa h an be re ursively generalized to the multivariate ase by simply onsidering the isomorphism Q (y1 ; y2; : : : ; ys) = Q (y1 ; : : : ; ys 1)(ys) and iterating the method for ea h indeterminate.
2.5.3 Bounding the Degrees of the Solutions

In order to have a good bound on the degree of d, d1; d2; : : : ; dn 1 we an again


use Hadamard bound.
In fa t, for any square matrix M 2 Q (y)n;n we have that
j det(M (x))j 

n
Y
i=1

jjMi(x)jj2 

n
Y
i=1

jjMi(x)jj1; x 2 Q ;

(2.48)

where Mi is the i-th row in M .


Sin e this holds for any x 2 Q (and su h that it does not divide any of the
denominators of the entries of the M ) we must also have
n
Y

n
X

i=1

n
X

i=1
n
X

j =1

i=1

deg(det(M (x)))  deg( jjMi(x)jj1) =


=

n
X
i=1

deg( jmi;j j) =

deg(jjMi(x)jj1) =
max (deg(mi;j ));

(2.49)

j =1;:::;n

where mi;j is the element of M in the i-th row and j -th olumn.
This is generalized to the upper determinant of a matrix by simply taking all
possible determinants of submatri es of size n  n.
Then for a re tangular matrix A 2 Q m;n a bound on the degree of the determinant of A is also given by:
m
X
i=1

max (deg(ai;j )):

j =1;:::;n

Example 2.5.1.

Let us onsider the matrix


A=

n 1
n2
3
n + 2n n + 5

(2.50)

2.6.

DISTRIBUTED COMPUTATION

47

Then a bound on the degree of the determinant of A is given by


max(1; 2) + max(3; 1) = 5;
(2.51)
whi h, in this ase, oin ides with the degree of det(A) = n5 2n3 + n2 +4n 5.
2.5.4 A Combination of the two Approa hes

The modular approa h and the interpolation approa h an work together when
working on matri es with entries in Q (y1 ; : : : ; ys). For ea h indeterminate and
for the ground eld Q we an re ursively re onstru t d, d1, d2,..., dn 1 by interpolation over ea h indeterminate and by the Chinese remainder theorem over
Q.

2.6 Distributed Computation


Both the ase K = Q and the ase K = Q (y1 ; : : : ; ys) perform the following main
operations:
1. Solving the homomorphi images of the original problem,
 modular image in the rational ase,
 evaluation image in the rational fun tion ase.
2. Colle ting the results,
3. Re onstru ting the solutions.
 Re onstru tion by the Chinese remainder theorem in the rational ase,
 Re ontru tion by interpolation in the rational fun tion ase.

48

CHAPTER 2.

CRAMER DRIVEN INTERPOLATION

Solving the homomorphi images and re onstru ting the solutions an be


performed in parallel, namely ea h image an be solved independently and ea h
omponent of the solutions an be re onstru ted independently as in the following
s heme:
A0jb
mod p1 (A0 jb)

d(1); d1(1); dn

mod

1(1)

p (A0jb)
l

d(l); d1(l); dn

Gaussian
Elimination

1(l )

Merging of the results


Re onstru tion

d(1); d(2); : : : ; d(l)

dn

1(1); dn 1(2); : : : ; dn 1(l )

dn

2.7 The Pa kage


My library implements the algorithms des ribed above for the univariate ase and
the rational ase has been implemented in the Mathemati a language [Wol99. A
generalization to the multivariate ase would be easy to implement but the poor
performan e of this approa h dis ouraged me to pro eed further into this dire tion. A better approa h is presented in the next hapter. The library is available
on the world wide web at the ombinatori s home page of RISC (University of
Linz, Austria) at the following web address
http://www.ris .uni-linz.a .at/resear h/ ombinat/

2.7.

THE PACKAGE

49

2.7.1 Loading the Pa kages

All the routines are ontained in the following Mathemati a pa kages:


matrixTools.m
Matrix manipulations
detBound.m
Bounds for absolute values of determinants
detDegreeBound.m
Bounds for degrees of determinants
CramerNullSpa e.m Interpolation Routines
The main pa kage CramerNullSpa e.m will automati ally load the remaining
pa kages. It an be evaluated within the Mathemati a environment as any other
pa kage by the ommand:
<< CramerNullSpa e.m

2.7.2 The Commands

The pa kage CramerNullSpa e.m provides the following ommands:


ChNullSpa eAt[ oefs, evalPoint, detBound
ChNullSpa eUntil[ oefs, intPoints
DistChNullSpa eUntil[ oefs, intPoints

Example 2.7.1 and Example 2.7.2 are related to the systems that are solved
in Zeilberger's algorithm for de nite hypergeometri summation (see Algorithm
1.2 in the rst hapter).
Solving Linear Systems at One Point
Command

ChNullSpa eAt[ oefs, evalPoint, detBound

Parameters





oefs is the matrix whose null spa e has to be found

evalPoint is the point at whi h we intend to evaluate the matrix

detBound is the bound (2.17)

Semanti s

The ommand ChNullSpa eAt[ oefs, evalPoint, detBound solves the


system of linear equations ontained in oefs for n = evalP oint by solving for
di erent ma hine size primes and then by re onstru ting the solution via the
Chinese remainder theorem with the bound given by detBound. It outputs a pair
ontaining the solution and an ordered list ontaining the indexes of the rows in
the upper part of the triangularized matrix.

50

CHAPTER 2.

CRAMER DRIVEN INTERPOLATION

Example 2.7.1.

We an use ChNullSpa eAt to nd the null spa e of


0
n+1
3
0
2n
0
5n
A=
n2 + n + 1 n2 n2 2n + 3
for n = 1; 2; 3, as follows
Table[ChNullSpa eAt[A, i, 100, i, 1, 3
fff 35; 0; 14; 35g; f1; 2; 3gg,
ff 35; 165; 59; 150g; f1; 2; 3gg,
ff423; 1086; 30; 261g; f1; 2; 3ggg

2n 1
n2 + 1 A
n2 + 2n

(2.52)

Solving a System by Interpolation


Commands




ChNullSpa eUntil[ oefs, intPoints


DistChNullSpa eUntil[ oefs, intPoints

Parameters




oefs is the matrix whose null spa e has to be found

intPoints is the number of interpolation points that have to be onsidered

Semanti s

Both ommands solve the system of linear equations ontained in oefs by


iteratively invoking ChNullSpa eAt for as many hoi es of n as intPoints, and
then by interpolating the results via Lagrange interpolation.
The ommand DistChNullSpa eUntil does the same as ChNullSpa eUntil
but uses the pa kage Distributed Mathemati a (see [PS00) to solve with respe t to
as many interpolation points as possible in parallel over a network of omputers.
Example 2.7.2.

We an use ChNullSpa eUntil or DistChNullSpa eUntil to nd the null spa e


of the following matrix
0
1
0
0
2n + 1 1
A=
2n 2
0
2n + 2
n2 + 1 A (2.53)
n2 + 2n + 1 n2 + 2n + 1 n2 2n 1 n2 2n 1
as follows

2.8.

CONCLUSION

51

ChNullSpa eUntil[A, 10 // Simplify

ff2(1 + n)3 (1 + 2n); (1 + n)4; 3(1 + n)4; 2(1 + n)3 gg

or in parallel with the ommand DistChNullSpa eUntil:


<< dist.m

Distributed Mathemati a V1.0.0 ( ) 2000 Cleopatra Pau (RISC-Linz)


See http://www.ris .uni-linz.a .at/software/distmath
InitializeD[pinwheel, o tane, andromeda, o tane, galaxy, solaris

Conne ting pinwheel...


Conne ting andromeda...
Conne ting galaxy...
okay

AllD["<< CramerNullSpa e.m"

okay

ff1; 0; 0; 1+2ng; f 2 2n; 0; 2+2n; 1 n2g; f1+2n + n2; 1+


2n + n2 ; 1 2n n2 ; 1 2n n2 gg"
AllD["myCoefs =

okay

DistChNullSpa eUntil[myCoefs, 10 // Simplify

ff2(1 + n)3 (1 + 2n); (1 + n)4; 3(1 + n)4; 2(1 + n)3 gg

The ommand InitializeD initializes the omputers available


on the network. The ommand AllD \broad ast" a ommand to all the omputers
in the network.
Remark 2.7.1.

2.8 Con lusion


The two variations of the approa h based on Cramer's rule and on polynomial
interpolation and on the Chinese remainder theorem perform very badly when
ompared with an approa h based on rational interpolation, whi h is presented
in the next hapter. Therefore I have not further developed nor extended the
implementation of this method.
The problems en ountered are:
 The method works under restri tive hypotheses (rank, matrix form, hoi e

of primes)
 The method requires the dete tion of unlu ky ases
 Too many homomorphi images are omputed (see explanation in the next
paragraph)

52

CHAPTER 2.

CRAMER DRIVEN INTERPOLATION

The ex essive number of ne essary homomorphi images is not aused by a


bad bound on the degree of the polynomials but it is intrinsi in the approa h.
The determinant of the upper matrix and those of the Cramer matri es are the
denominator and numerators of the omponents of the solution but they often
have ommon fa tors that annot be predi ted in advan e.
This experien e made lear that an alternative had to be onsidered. A better
approa h is treated in the next hapter in whi h rational fun tion interpolation
and a hybrid method based on guessing and symboli omputation is used.

Chapter 3
Rational Interpolation

3.1 Introdu tion


We give a brief des ription of the theory behind the rational fun tion re onstru tion problem as des ribed in [GvzG99, pages 106{115. Rational fun tion
re onstru tion is the problem of nding a rational fun tion that is ongruent to
some polynomial modulo some other polynomial. Rational fun tion re onstru tion has two important appli ations: rational interpolation and rational fun tion
approximation. We use rational fun tion interpolation to build an algorithm that
omputes the null spa e of a re tangular matrix with entries in Q (y1 ; : : : ; yn) by
re onstru ting some low degree omponents of the solutions by rational fun tion
interpolation and the others symboli ally. This is done by plugging the omponents re onstru ted by rational fun tion interpolation into the system in order
to simplify it. In su h a way the new system an be ome solvable by Gaussian
elimination over Q (yi ; : : : ; yir ) with 1  ij  n and r < n. Alternatively the system an be solved by iterating the pro edure on the remaining variables. These
algorithms have been implemented in the Mathemati a omputer algebra system.
1

3.2 Re onstru ting Rational Fun tions


In the following let F be a eld, m 2 F [x be a polynomial of positive degree
n (whi h will serve as modulus), and f 2 F [x be a polynomial of degree less
than n.
De nition 3.2.1. Given a; b 2 F [x, we de ne the j -th row of the extended
Eu lidean algorithm for a and b to be the ordered triplet (r; s; t), with r; s; t 2
F [x, where r is the remainder, and s, t are the orresponding ofa tors omputed
at the j -th step of the Algorithm 3.1 (generalized extended Eu lidean algorithm)
for a and b.
53

54

CHAPTER 3.

RATIONAL INTERPOLATION

Algorithm 3.1 Generalized Extended Eu lidean Algorithm


Input: (f; g ) with f; g 2 F [x.
Output: l 2 N ; rj ; sj ; tj 2 R for 0  j  l as omputed below.
1: r0 := Norm(f ); s0 := L oe x (f ) 1 ; t0 := 0;
r1 := Norm(g ); s1 := 0; t1 := L oe x (g ) 1;
2: i := 1;
3: while ri 6= 0 do
4:
qi := ri 1 quot ri ; // Quotient of ri 1 divided by ri
ri+1 := ri 1 mod ri ;
si+1 := (si 1 qi si )= L oe x (ri+1 ); // L oe x = leading oeffi ient
ti+1 := (ti 1 qi ti )= L oe x (ri+1 ); // Norm(f ) = f L oe x (f ) 1
i := i + 1;
ri+1 := Norm(ri+1 )
5: return i; rj ; sj ; tj , for 0  j  i:

Given k 2 f0; 1; : : : ; ng we want to nd a rational fun tion r=t 2 F (x), with


r; t 2 F [x su h that
g d(t; m) = 1;
(3.1)
rt 1  f mod m; deg r < k; deg t  n k;
where t 1 is the inverse of t modulo m.
The following theorem des ribes the onditions under whi h (3.1) has solutions.
Theorem 3.2.1. Let rj ; sj ; tj 2 F [x be the omponents of the j -th row in the
extended Eu lidean algorithm for m and f , where j is the minimal integer su h
that deg rj < k.
1. If g d(rj ; tj ) = 1 then rj and tj solve (3.1).
2. If r=t is a anoni al form solution to (3.1) then g d(rj ; tj ) = 1 and r =
 1 rj and t =  1 tj , where  is the leading oe ient of tj .
Corollary 3.2.2. There is an algorithm whi h de ides whether (3.1) has a solution, and if so, omputes the solution in O(n2 ) operations in F .

For the proofs and more details we refer to [GvzG99, pages 106{115.

3.3 Cau hy Interpolation


In the following let u0; u1; : : : ; un 1 be distin t elements of F , and for 0  i < n,
let vi = g(ui) be a olle tion of samples of an unknown fun tion g : F ! F .

3.3.

CAUCHY INTERPOLATION

55

Cau hy interpolation is the problem of rational interpolation where, given a


olle tion of samples vi , for 0  i < n of an unknown fun tion g at distin t points
u0 ; u1 ; : : : ; un 1 and given k 2 f0; 1; : : : ; ng, we want to nd a rational fun tion
r=t 2 F (x), with r; t 2 F [x, su h that
t(ui ) 6= 0;
(3.2)
r(ui)=t(ui ) = vi ; 0  i < n; deg r < k; deg t  n k:
We will refer to the solutions of (3.2) as \rational interpolant" .
Lemma 3.3.1. Let (ri ; si ; ti ) be the i-th row in the extended Eu lidean algorithm
for (a(x); b(x)) 2 F [x. Then
g d(ri; ti) = g d(a; ti):
(3.3)
For the proof we refer to [GvzG99, pages 106{115.
The following orollary of Theorem 3.2.1 des ribes the solutions to the problem (3.2).
Corollary 3.3.2. Let f 2 F [x of degree less than n, with f (ui ) = vi for 0  i <
n, let k 2 f0; 1; : : : ; ng and rj ; sj ; tj 2 F [x be the omponents of the j -th row in
the extended Eu lidean algorithm for ((x u0 )  (x u1 )    (x un 1); f ), where
j is minimal su h that deg rj < k.
1. If g d(rj ; tj ) = 1 then rj and tj solve (3.2).
2. If r=t 2 F (x) is a anoni al form solution to (3.2), then g d(rj ; tj ) = 1 and
r =  1 rj and t =  1 tj , where  is the leading oe ient of tj .
Problem (3.2) is a spe ial instan e of problem (3.1) where
m = (x u0 )  (x u1 )      (x un 1 );
(3.4)
and where f is the interpolating polynomial of degree less than n.

Therefore in order to nd a solution to (3.2) we apply Algorithm 3.1 (generalized extended Eu lidean algorithm) to (m; f ), with m as in (3.4). If the
g d(rj ; tj ) 6= 1 then, by Lemma 3.3.1, also g d(m; tj ) 6= 1 and therefore t(ui) = 0
for some i 2 f0; 1; : : : ; n 1g and (3.2) has no solution.
Proof.

Example 3.3.1.
Let us take F = Z5 and let us nd the rational fun tions  = r=t 2 Z5 su h that
(0) = 1;
(1) = 2;
(2) = 4:

56

CHAPTER 3.

RATIONAL INTERPOLATION

First of all we ompute the interpolating polynomial f of degree less than 3:


f = 3x2 + 3x + 1:
Then the extended Eu lidean algorithm for (m; f ) with m = x(x 1)(x 2) =
x3 + 2x2 + 2x and f yields the following sequen e of remainders and ofa tors
j rj
sj
tj
0 x3 + 2x2 + 2x 1
0
2
1 x +x+2 0
2
2 x+2
4
2x + 2
3 1
4x + 1
2x2 + 1
4 0
x2 + x + 2 3x3 + x2 + x

From the sequen e we an read o the following solutions orresponding to


the rows i where the g d of ri and ti is one
r1 =t1 =

x2 + x + 2

2
x+2
r2 =t2 =
2x + 2 ;
1
r3 =t3 = 2 :
2x + 1

(3.5)

Corollary 3.3.3. There is an algorithm the de ides whether the problem (3.2)
has a solution, and if so, it omputes it in O(n2 ) arithmeti operations in F .

3.4 Pade Approximation


Pade approximation (see
[GvzG99, pages 112{115) is the problem of approximating a power series Pi0 fixi 2 F [[x with all fi 2 F to a rational fun tion
r=t 2 F [x with r; t 2 F [x and x - t.
Formally, given k 2 f0; 1; : : : ; ng and f 2 F [x of degree less than n we want
to nd a rational fun tion r=t 2 F (x) with r; t 2 F [x su h that
x - t; r=t  f mod xn ; deg r < k; deg t  n k:
(3.6)
Corollary 3.4.1. Let f 2 F [x of degree less than n, k 2 f0; 1; : : : ; ng, and
rj ; sj ; tj 2 F [x be the omponents of the j -th row of the extended Eu lidean
algorithm for (xn ; f ), where j is minimal su h that deg rj < k.
1. If g d(rj ; tj ) = 1 then rj and tj are solutions to (3.6).
2. If r=t is a anoni al form solution to (3.6), then g d(rj ; tj ) = 1 and r =
 1 rj , t =  1 tj , where  is the leading oe ient of tj .

3.5.

HOMOGENEOUS LINEAR SYSTEMS

Proof.

57

Problem (3.6) is an instan e of (3.1) for m = xn.

We will refer to the solutions of (3.6) as \Pade approximants".


Thus the Pade approximants are obtained by omputing rj and tj through Algorithm 3.1 (generalized extended Eu lidean algorithm) and by he king whether
their g d is one, and if so, no su h approximant exists, otherwise rj =tj is a solution
to (3.6).

Corollary 3.4.2. There is an algorithm that de ides whether (3.6) has a solution,
and if so, it omputes it in O(n2 ) arithmeti operations in F .

3.5 Homogeneous Linear Systems


We an apply rational fun tion interpolation to re onstru t the omponents of
the solutions of a homogeneous system of linear equations with polynomial or
rational fun tion oe ients.
Given A 2 Q (y1 ; : : : ; yp)m;n, we want to nd x = (x1 ; : : : ; xn), with xi 2
Q (y1 ; : : : ; yp), 1  i  n su h that
Ax = 0:
(3.7)
De nition 3.5.1. We de ne  (A) to be the ordered sequen e of n-tuples ontaining the null spa e of A obtained by triangularization and ba k-substitution.
Given A 2 Q (y1 ; : : : ; yp)m;n and a p-tuple v = (v1; v2 ; : : : ; vp) of rational numbers, the notation evalv (A) denotes the matrix obtained from A by substituting
in all entries of A vi to yi, for 1  i  p, whenever no denominator of any of
the entries of A be omes zero. Besides, given an ordered sequen e  of n-tuples
of rational fun tions in Q (y1 ; : : : ; yp), the notation evalv ( ) denotes the ordered
sequen e obtained from  by substituting in all n-tuples vi to yi, for 1  i  p,
whenever no denominator of any of the omponents of the n-tuples be omes zero.
De nition 3.5.2. We onsider the ve tors v 2 Q (y1 ; : : : ; yp) for whi h evalv (A)
and evalv ( (A)) are de ned and su h that
 (evalv (A)) = evalv ( (A)):
(3.8)
We all the ve tors v lu ky evaluations for A.
In the next se tions we des ribe various strategies and tools for experimentations for the omputation of the null spa e by rational fun tion interpolation that
I have implemented in the Mathemati a pa kage RatNullSpa e (for the details
on the pa kage see Se tion 3.6).

58

CHAPTER 3.

RATIONAL INTERPOLATION

3.5.1 The First Try

We an re onstru t  (A) by taking the solutions  (evalv (A)) of su iently many


lu ky evaluations and by rational fun tion interpolation.
If we always hoose lu ky evaluations, this method is an algorithm that orre tly re onstru ts the solutions. What makes this brute for e approa h useless
in many ases is the fa t that the bound on the number of ne essary evaluations
is often too high.
3.5.2 A Heuristi Method

A slightly di erent method would be using rational fun tion interpolation in


an iterative way. We remove those possible solutions that hange on e a new
evaluation is onsidered and keep the others. On e we have a unique andidate,
we take that as the solution.
I ould not nd examples for whi h this heuristi failed to re onstru t the
orre t solution. Moreover this method does not require any bound and it is
mu h faster than the previous method. I implemented this method in the pa kage
RatNullSpa e.m whi h is des ribed in this hapter (see ModularNullSpa e).
3.5.3 A Re ursive Method

We des ribe a re ursive method that improves the previous heuristi method.
Su h improved heuristi re onstru ts rst those omponents that require few
evaluations to stabilize, then plugs their values into the system in order to simplify
it and re ursively re onstru ts the remaining omponents in the simpli ed system.
I implemented this method in the pa kage RatNullSpa e.m whi h is des ribed
in this hapter (see CompleteNullSpa e).
3.5.4 A Hybrid Method

An ever faster method is to use the heuristi method only for those omponents
that require few evaluations to stabilize. On e these omponents have been omputed their values an be plugged in into the original system in order to simplify
it. Then the simpli ed system an be solved by a symboli algorithm. This
method generalizes the work in [RZ. I implemented this method in the pa kage
RatNullSpa e.m, whi h is des ribed in this hapter (see RatNullSpa e).
This method an be sped up by putting into the system extra information on
the degree of the omponents of the solutions.
Bla k Lists

If we know in advan e whi h omponents require fewer evaluations we an avoid


trying to re onstru t the others. This is implemented by putting these ompo-

3.6.

THE PACKAGE

59

nents into a bla k list. These omponents will be omputed symboli ally.
Delayed Interpolation

If we have a lower bound for the number of evaluations ne essary to re onstru t


the omponents we an avoid interpolation until the ne essary number of evaluations has been rea hed. Having this information an be parti ularly useful when
using non-in remental interpolation algorithms.

3.6 The Pa kage


A pa kage that implements null spa e omputation through rational fun tion re onstru tion has been implemented in the Mathemati a omputer algebra system
[Wol99. The pa kage is available on the world wide web at the ombinatori s
home page of RISC (University of Linz, Austria) at the following web address
http://www.ris .uni-linz.a .at/resear h/ ombinat/
The pa kage an be loaded as any other Mathemati a pa kage by the ommand:
<< RatNullSpa e.m
The pa kage provides fun tions for omputing the null spa e by the heuristi method, by the re ursive method and by the hybrid method as des ribed in
the previous se tion. The pa kage provides also some lower level routines that
implement rational fun tion re onstru tion and rational fun tion interpolation.
3.6.1 The Commands

Null spa e omputation is implemented in the fun tions


 RatNullSpa e
 ModularNullSpa e
 MultiModularNullSpa e
 HybridNullSpa e
 MultiHybridNullSpa e
 CompleteNullSpa e
All the ommands ex ept CompleteNullSpa e take as input a matrix and
output the null spa e. Both input and output follow the Mathemati a onvention
used in the internal NullSpa e ommand.

60

CHAPTER 3.

RATIONAL INTERPOLATION

A omponent is given the onventional value "?" meaning non- omputed when
either it annot be omputed be ause of too few interpolating points or the user
desires not to ompute it.
The ommand InterpolatingRatFun tion provides univariate rational fun tion interpolation.
Example 3.6.1, 3.6.2, 3.6.3 and 3.6.4 are related to the systems that are
solved in Zeilberger's algorithm for de nite hypergeometri summation (see Algorithm 1.2 in the rst hapter).
3.6.2 Modular Null Spa e Computation
Commands




ModularNullSpa e[ oefs
MultiModularNullSpa e[ oefs

Parameter
oefs ontains the matrix whose null spa e has to be omputed.
Options

Name

StartingInterpolation
Offset
DegreeBound
Var
Verbose
Algorithm
Bla kList

Semanti s

Default Value
3
3
6
0 (not de ned)
O
NullSpa e
fg

The ommands ModularNullSpa e and MultiModularNullSpa e ompute all


the omponents of the ve tors in the null spa e ex ept those whose positions are
in Bla kList.
ModularNullSpa e uses rational fun tion interpolation on the variable passed
as a single element through the option Var or, when no option is given (Var is 0),
on the rst variable in the lexi ographi order ontained in oefs.
The ommand MultiModularSpa e uses rational fun tion interpolation on
ea h variable passed as a list through the option Var or, when no option is given
(Var is 0), on all variables.
Meaning of the options

StartingInterpolation is the number of minimal interpolation points at


whi h the interpolation algorithm is invoked.

3.6.








61

THE PACKAGE

is the initial integer interpolating point.


DegreeBound is the maximum number of interpolating point to be onsidered after whi h, in ase of unsu essful result, the value "?" is assigned to
the omponent.
Var is the variable or variables (passed as a list) with respe t to whi h the
interpolation should be performed. When it has value 0 it means \the rst
variable found in oefs" if used in ModularNullSpa e, or \all the variables
found in oefs" when used in MultiModularNullSpa e.
Verbose toggles the verbosity and an be set either to On or Off.
Algorithm is the algorithm whi h has to be used to solve ea h homomorphi
image.
Bla kList is a the set (passed as a list of positive integers) ontaining
the positions of those omponents that are not to be omputed. Those
omponents are given the onventional value "?".

Offset

A Univariate Example
Let us ompute the null spa e of the following matrix with univariate polynomial
entries:
Example 3.6.1.

1
n3 + 2
n 2
4n + 1 1
2n 2
0
2n + 2
n2 + 1 A
A=
(3.9)
2
2
2
2
n + 2n + 1 n + 2n + 1 n 2n 1 n 2n 1
This an be done ModularNullSpa e. Let us try to re onstru t the omponents by using at most 5 interpolating points:
ModularNullSpa e[A, DegreeBound -> 5

Output =

ff?; 1 +2 n ; ?; 1gg

(3.10)
Two omponents are left without a value. Trying with an extra point yields
the omplete solution:
ModularNullSpa e[A, DegreeBound -> 6

Output =
2
3
4
3
4
ff 6 + 7n2(+ n1 ++nn) + n ; 1 +2 n ; 5 +2(9n +1 +n n+) n ; 1gg

(3.11)

62

CHAPTER 3.

RATIONAL INTERPOLATION

A Multivariate Example
Let us now onsider the following matrix with bivariate polynomial entries:
0
1 m+n 0 m+1 1
0 2n + 2 0 A
A= 2
(3.12)
m
0
0
n
We an nd the null spa e of A by either the ommand ModularNullSpa e
or by the ommand MultiModularNullSpa e.
Example 3.6.2.

ModularNullSpa e[A, DegreeBound -> 6, Var->m

or
MultiModularNullSpa e[A, DegreeBound -> 6

Output =

2
ff mn ; mm2 +mmn+ n ; m(1n+ n) ; 1gg

(3.13)

3.6.3 Completing the Null Spa e


Command

CompleteNullSpa e[ oefs, parSols

Parameters




oefs is the matrix whose null spa e has to be found

parSols is a partially omputed null spa e, i.e. it an ontain omponents


whose value is "?". It an be the output of ModularNullSpa e or of the
ommand MultiModularNullSpa e.

Options

Name

Verbose
Algorithm

Semanti s

Default Value
O
NullSpa e

CompleteNullSpa e takes parSols and uses this information to simplify the


system by plugging in the values of the omponents in parSols that do not have
value "?". The new system will be devoid of these unknowns. Then it invokes
the null spa e algorithm passed through the option Algorithm on the simpli ed
system and returns a list of lists ontaining those omponents that had value "?"
in oefs and the last omponent.

3.6.

63

THE PACKAGE

Meaning of the options




toggles the verbosity level and an be either On or Off.


Algorithm is the null spa e algorithm whi h is used to nd the omponents
whose value in parSol is "?", i.e. those omponents that have not been
omputed.
Verbose

Example 3.6.3.

Let us onsider the matrix:


0
n 1
0
0
2n + 1 1
0
2n
n2 + 1 A
A =  2n
n + 1 n 2 + 3n + 1 n 2 1 n 2 1
We an guess some omponents of the solutions by:

(3.14)

ms = ModularNullSpa e[A, DegreeBound -> 4

Output =

ff 11 +2nn ; ?; ?; 1gg

(3.15)
Then we an use this result to nd the remaining omponents by the ommand
CompleteNullSpa e:
CompleteNullSpa e[A,ms

Output =

2
3
4
2
3
ff 1 +22nn(1 +2n3n + 2nn2 ) + n ; 1 2(3n 1 +5nn)n+ n ; 1gg

3.6.4 Hybrid Modular Symboli Null Spa e


Commands





HybridNullSpa e[ oefs
MultiHybridNullSpa e[ oefs
RatNullSpa e[ oefs

Parameter
oefs ontains the matrix whose null spa e has to be omputed.

(3.16)

64

CHAPTER 3.

Options

Name

RATIONAL INTERPOLATION

Default Value
O
NullSpa e
NullSpa e
3
3
6
0 (not de ned)
fg

Verbose
ModularAlgorithm
Symboli Algorithm
StartingInterpolation
Offset
DegreeBound
Var
Bla kList

Semanti s

invokes ModularNullSpa e and then CompleteNullSpa e


to nd the null spa e.
MultiHybridNullSpa e and RatNullSpa e are two di erent names for the
same ommand. They invoke MultiModularNullSpa e and CompleteNullSpa e
to nd the null spa e.
HybridNullSpa e

Meaning of the options

is passed to the modular null spa e algorithm.


Offset is passed to the modular null spa e algorithm.
DegreeBound is passed to the modular null spa e algorithm.
Var is passed to the modular null spa e algorithm.
Bla kList is passed to the modular null spa e algorithm.
Verbose toggles the verbosity level, it an be either On or Off and it is
passed to ModularNullSpa e and to CompleteNullSpa e.
 ModularAlgorithm is passed through the option Algorithm to the modular
null spa e algorithm.
 Symboli Algorithm is passed through the option Algorithm to the ommand CompleteNullSpa e.








StartingInterpolation

Example 3.6.4.

Let us onsider the matrix A with polynomial entries:


=

0
BB
BB


6n 9
15n2 + 4n + 3
3

0
0
0

3n 1
7n2 + n + 6

0
0
0
2
n+1

0
0
2
3n + 1
6

0
2

3n

+1

3n 3
3n 3
n

1
C
C
C
C
A
(3.17)

3.6.

65

THE PACKAGE

We an nd its null spa e by any of the null spa e algorithms that use the hybrid
method:
RatNullSpa e[A

Output=

ff

530 + 639n 801n2 143n3 + 71n4


;
4(13 + 6n + 17n2 )
486 + 2614 + 2727n2 + 429n3 + 1115n4 803n5 1
;
( 42
4(13 + 6n + 17n2 )
4
3
(5 + 3n); 1gg
2
2;

71n + 33n2 );

(3.18)

Superiority over Mathemati a


We an use HybridNullSpa e to nd the null spa e of matri es faster than by
the Mathemati a built-in null spa e algorithm. For instan e we an onsider the
system that has to be solved by Zeilberger's algorithm applied to the binomial
oe ient to the fth power, i.e. the problem of nding a spe ial linear re urren e
(see Theorem 1.2.3) with polynomial oe ients in n and free of k (see re urren e
(1.1)) for
n  5
X
n
:
(3.19)
k
Example 3.6.5.

k=0

One possible way to obtain the matrix is to run parGosperLinSys in the Maxima implementation of Zeilberger's algorithm, whi h performs Zeilberger's algorithm with verbose linear system solving. For more details on how Zeilberger's
algorithm works we refer to the rst hapter of this thesis and to [Car99, [PS95,
[Zei90, [Zei91.
On e we have the matrix, say, in b5 oefs we an nd its null spa e in 37:69s
as follows:
HybridNullSpa e[b5 oefs,
Bla kList -> {2, 3, 4, 5, 6, 7, 8, 9, 10}

Output =

ff2; ( 514048 2341112n 4509834n2 4764843n3

2982616n4 1106342n5 225214n6 19415n7)=


(3.20)
2
(16(292 + 253n + 55n )); : : : g
The Mathemati a ommand NullSpa e an solve the problem in 163:44 se onds. The tests were run on an SGI O tane (with two 200 Megahertz pro essors)
with 2 Gigabytes RAM. We used Mathemati a 4.0.
The ommand was used as follows

66

CHAPTER 3.

RATIONAL INTERPOLATION

NullSpa e[b5 oefs // Together

The same ommand not followed by the ommand Together, whi h takes
are of adding up rational fun tions, produ es a rash of Mathemati a 4.0.
3.6.5 Rational Fun tion Interpolation

Rational fun tion interpolation is implemented in the pa kage in the ommand


InterpolatingRatFun tion.
Command

InterpolatingRatFun tion[interpList, numBound, var.

Parameters





interpList is a list of interpolation points passed as a list of ouples (p; v ),


where v is the value assumed at p.
numBound is a bound on the degree of the numerator.

var is the indeterminate of the sear hed rational fun tions.

Semanti s

InterpolatingRatFun tion implements rational fun tion interpolation by


rst invoking a polynomial interpolation algorithm and then by invoking Algorithm 3.1 (generalized extended
Q Eu lidean algorithm) on the polynomial interpolant and on the polynomial i (var pi), where pi are the interpolation points.

Example 3.6.6.

Let us interpolate the rational fun tion f :


f (x) =

x 1
;
x2 + 3

(3.21)

by only knowing f at the values 1; 2; 3; 4:


1
2
3
1
f (1) = ; f (2) = ; f (3) = ; f (4) = :
(3.22)
7
6
19
7
This an be done by InterpolatingRatFun tion in the following way:
InterpolatingRatFun tion[{{1,0},{2,1/7},{3,1/6},{4,3/19}},3,x

Output =

2
2
3
f 556 + 766x1596233x + 23x ; 9 3++1023x x x ; 3 1++x2x g

(3.23)

3.7.

67

CONCLUSION

The result ontains f but also other rational fun tions that interpolate the
points in (3.22) but have numerator and denominator with di erent degrees.
If we knew the degree of the numerator of f we ould hoose the orre t
answer. Otherwise we an try to guess it with very high probability by taking
into a ount extra points and taking those solutions that are both in the old and
new set of interpolants.
Let us take for instan e
1
f (5) = :
(3.24)
7
Then we get
InterpolatingRatFun tion[
{{1,0},{2,1/7},{3,1/6},{4,3/19},{5,1/7}},3,x

Output =

82x 15x2 + x3 ; 1 + x g
f 68 +28(3
+ 4x)
3 + x2

(3.25)
We see that f = ( 1 + x)=(3 + x2 ) is the only rational fun tion ontained in
both solution sets ((3.23),(3.25)).

3.7 Con lusion


As seen in Example 3.6.5 rational fun tion interpolation for guessing low degree
omponents of solutions of homogeneous systems of linear equations performs
mu h better than the method based on Cramer's rule and polynomial interpolation (des ribed in the previous hapter).
The method based on Cramer's rule and polynomial interpolation re onstru ts
the numerators and denominators of the omponents of the solutions as given
by Cramer's rule, whereas the method based on rational fun tion interpolation
re onstru ts the simpli ed numerators and denominators.
The bottle-ne k of this approa h, as it is implemented now, is the interpolation
step in whi h the generalized extended Eu lidean algorithm (Algorithm 3.1) is
invoked.
A future version of the pa kage ould use a more e ient interpolation algorithm.

68

CHAPTER 3.

RATIONAL INTERPOLATION

Chapter 4
Linear Systems in Zeilberger's
Algorithm

4.1 Introdu tion


Given a proper hypergeometri term F (n; k) (see De nition 4.3.1) and a linear
shift operator L of order d with polynomial oe ients, we prove that the Gosper
form (p(n; k), q (n; k), r(n; k)) (see De nition 4.3.6 and Algorithm 4.1) of the shift
quotient in k of LF (n; k) is su h that the degree in n of q(n; k) and r(n; k) an
be bounded independently of d. This gives some insight on the
Pndegree in n of the
polynomial oe ients of the linear re urren e satis ed by k=0 F (n; k) that is
omputed by Zeilberger's algorithm. We do this in two steps: rstly by proving
the existen e of ertain bije tions between subsets of the natural numbers whi h
re e t the properties of the Gosper form; se ondly by interpreting this abstra t
model in terms of the polynomials involved in the Gosper form.

4.2 The Abstra t Model


Given any positive integers n, s with s 6= 0, n  2s, and a subset H of f1; : : : ; ng,
we onstru t a bije tion between a subset of fs + 1; : : : ; ng n (H + s) and a
subset fs + 1; : : : ; ng n H with the property that for any i in its domain, (i) i
is a non-negative multiple of s. Besides we show that is the bije tion between a
subset of fs +1; : : : ; ng n (H + s) and a subset fs +1; : : : ; ng n H with the largest
possible domain and su h that (i) i is a non-negative multiple of s.
4.2.1 Notation

Throughout this se tion n, s are xed positive integers with s 6= 0, n  2s, and
is a given subset of f1; : : : ; ng. We use the following notation:

69

70

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

A(H ) = H \ f1; : : : ; sg;


B (H ) = H \ fs + 1; : : : ; n sg;
C (H ) = H \ f1; : : : ; n sg;
D(H ) = H \ fn s + 1; : : : ; ng:

(4.1)

Pi torially:
C (H )=A(H )[B (H )
}|

1; 2; : : : ; s; s + 1; s + {z2; : : : ; n
| {z } |
A(H )=H \

B (H )=H \

s}; n| s + 1; n {z s + 2; : : : ; n}
D(H )=H \

Given a fun tion f : X ! Y , we denote by dom(f ) the domain of f, i.e. X


and by im(f ) the image, i.e. the set ff (x)jx 2 X g.
Given a subset S  N and q 2 N we denote by S + q the set fp + qjp 2 S g.
4.2.2 The Fundamental Bije tion
In the next two theorems we treat the ase H  fs + 1; : : : ; n sg.
De nition 4.2.1. Given n; s 2 N , s 6=
1; : : : ; n sg. We de ne the fun tion H

0, su h that n  2s, and H  fs +

H : fs + 1; : : : ; ng n (H + s) ! fs + 1; : : : ; ng n H;

(4.2)

as follows:
If H is the empty set, we take the identity fun tion
; (i) = i;
(4.3)
for all i 2 dom H .
If H is not the empty set, we take for all i 2 dom H
(

(i);
if i 2 (fs + 1; : : : ; ng n (H + s)) n H1nfag (a); (4.4)
H (i) = H nfag
H nfag (a + s); if i = H1nfag (a);
where a denotes the minimum element in H with respe t to the natural ordering.
Example 4.2.1 des ribes the fun tion H for n = 9, s = 3 and H = f5; 6g.

4.2.

71

THE ABSTRACT MODEL

Theorem 4.2.1. Given n; s 2 N , s 6= 0, su h that n  2s, and H  fs +


1; : : : ; n sg. The fun tion H (see De nition 4.2.1) is well-de ned, is a bije tion
and is su h that H (i) i is a non-negative multiple of s, i. e. there exists a nonnegative integer mi su h that
H (i) i = mi  s:

(4.5)

Let us prove this theorem by indu tion on the ardinality of H .


When H is the empty set, we have the identity fun tion
; (i) = i;
whi h is a bije tion and it satis es the ondition (4.5) be ause:
; (i) i = 0 = 0  s:
Let us assume that the theorem holds for all subsets of fs + 1; : : : n sg of a
ertain given ardinality j . We prove it for an arbitrary subset H of fs +1; : : : n
sg of ardinality j + 1.
We onsider the fun tion H
H : fs + 1; : : : ; ng n (H + s) ! fs + 1; : : : ; ng n H;
whi h, by De nition 4.2.1, is
(
H nfag (i);
if
i 2 (fs + 1; : : : ; ng n (H + s)) n H1nfag (a);
H (i) =
(4.6)
H nfag (a + s); if i = H1nfag (a);
where a is the minimum element in H with respe t to the natural ordering.
We noti e that a must be in the image of H nfag and therefore H1nfag (a) is an
element of the domain of H nfag .
Pi torially:

Proof.

H1nfag(a)

H nfag(a + s)

a+s

The ondition (4.5) holds by the indu tion hypothesis for i 6= H1nfag (a).
When i = H1nfag (a) we have that by de nition of inverse and by the indu tion
hypothesis

72

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

H nfag (H1nfag (a)) H1nfag (a) = l  s;


{z
}
|

(4.7)

=a

where l is a non-negative integer.


Hen e, by (4.7) and by the fa t that H nfag (a + s) (a + s) = m  s, with m
a non-negative integer,
H (H1nfag (a)) H1nfag (a) = H nfag (a + s) (a l  s) =
(4.8)
= a + s + m  s a + l  s = (m + l + 1)  s:
The fun tion H is surje tive, be ause for i 2= fH1nfag (a); a + sg, H spans the
image of H nfag expe t for the values a and H nfag (a + s) and for i = H nfag (a)
it overs the value H nfag (a + s).
Inje tivity follows from the indu tive hypothesis and from the fa t that a + s 2=
dom(H ) and therefore for any i 2 dom(H ), i 6= H1(a),
H (i) = H nfag (i) 6= H nfag (a + s) = H (H1nfag (a)):

Example 4.2.1.
n = 9, s = 3, H = f5; 6g:

4
1

4
1

5
2

5
2

6
3

6
3

7
4

7
4

8
5

8
5

7 8 9
H

f5g

9 10 11 12
6 7 8 9

9 10 11 12
6 7 8 9
H

9 10 11 12

f5; 6g

(4.9)

4.2.

THE ABSTRACT MODEL

73

Theorem 4.2.2. Given n; s 2 N , s 6= 0, su h that n  2s, and H  fs +


1; : : : ; n sg. The fun tion H has the property that for any i 2 dom(H ),
H (i) i is the minimum non-negative multiple of s, i. e. we have
H (i) i
s

= min
(l j i + l  s 2 fs + 1; : : : ; ng n H ):
l2N

(4.10)

We pro eed by indu tion on jH j.


When H is the empty-set, we have H (i) = i for any i 2 dom(H ) and
therefore the minimality ondition (4.10) holds.
Given an arbitrary subset H of fs + 1; : : : ; n sg, let us assume that the
property holds for a subsets of fs +1; : : : ; n sg of lower ardinality than H , and
let us prove it for H .
Let us denote by a the minimum element1 in H with respe t to the natural
ordering. The property holds for any i 6= H nfag (a) be ause in this ase H (i) =
H nfag (i).
We have that H (H1nfag (a)) = H nfag (a + s).
Moreover, we have
a = H1nfag (a) + l1  s;
(4.11)
with
l1 = min(l j H1nfag (a) + l  s 2 im(H nfag ));
(4.12)
l2N
and
H nfag (a + s) = a + s + l2  s;
(4.13)
with
l2 = min(l j a + s + l  s 2 im(H nfag ));
(4.14)
l2N
and therefore
l2 + 1 = min(l j a + l  s 2 im(H nfag ) n fag):
(4.15)
l2N
Hen e

Proof.

H (H1nfag (a)) = H1nfag (a) + (l1 + l2 + 1)  s

(4.16)

l1 + l2 + 1 = min(l j H1nfag (a) + l  s 2 im(H nfag ) n fag);

(4.17)

where

{z
}
=H nfag (a+s)

l2N

be ause of the minimality of l1 and l2.




74

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

Pi torially:

H nfag(a + s)
1

H1nfag(a)
l1

a+s

l2

4.2.3 More General Bije tions

The following lemma and theorem generalize the previous theorems respe tively
to the ase H  f1; : : : ; n sg and to the ase H  f1; : : : ; ng.
De nition 4.2.2. Given n; s 2 N , s 6= 0, su h that n  2s, and H  f1; : : : ; n
sg, we de ne the fun tion H to be the following restri tion of H :

H = B(H ) dom (B H )n(A(H )+s) :
(4.18)
(

Lemma 4.2.3. Given n; s 2 N , s 6= 0, su h that n  2s, and H  f1; : : : ; n sg.


The fun tion H is su h that for any i 2 fs + 1; : : : ; ng n (H + s), H (i) i is a
non-negative multiple of s, i. e. there exists a non-negative integer mi su h that
Moreover
where

H (i) i = mi  s:

(4.19)

H : fs + 1; : : : ; ng n (H + s) ! R;

(4.20)

R  fs + 1; : : : ; ng n H;

(4.21)
The fun tion H is a bije tion that satis es the ondition (4.19) be ause
it is a restri tion of B(H ) .
It is de ned over fs + 1; : : : ; ng n (H + s) be ause B(H ) is de ned over fs +
1; : : : ; ng n (B (H ) + s).
Its image is a subset of fs + 1; : : : ; ng n H be ause the image of B(H ) is
fs + 1; : : : ; ng n B (H ) and H is a restri tion of H .


Proof.

4.2.

75

THE ABSTRACT MODEL

Example 4.2.2.
n = 6, s = 2

f3g

f2 ; 3 g

3 4 5 6 7 8
3 4 5 6 7
In the se ond ase we have: A(H ) = f2g and B (H ) = f3g.

We introdu e the notation


D (H ) = D(H ) \ im (C (H ) ):

(4.22)

Given n; s 2 N , s 6= 0, su h that n  2s, and H  f1; : : : ; ng,


we de ne the fun tion H to be the following restri tion of H

:
(4.23)
H = C (H ) dom (C H )n

C H (D (H ))
De nition 4.2.3.

1
( )

Theorem 4.2.4. Given n; s 2 N , s 6= 0, su h that n  2s, and H  f1; : : : ; ng.


We have that
(4.24)
H :P !R
where
P  fs + 1; : : : ; ng n (H + s);
(4.25)
R  fs + 1; : : : ; ng n H;
and
jP j; jRj = n s jC (H )j jD (H )j;
(4.26)
Moreover H is su h that for any i 2 P , h (i) i is a non-negative multiple
of s, i. e. there exists a non-negative integer mi su h that
(4.27)
H (i) i = mi  s:

The fun tion H is a bije tion that satis es the ondition (4.27) be ause
it is a restri tion of C (H ).
We noti e that H is then de ned over
(fs + 1; : : : ; ng n (C (H ) + s)) n C 1(H ) (D (H ))
whi h has ardinality
n s jC (H )j jD (H )j:


Proof.

76

CHAPTER 4.

Example 4.2.3.
n = 6, s = 2:

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

f2; 4g

f2; 4; 5; 6g

3 4 5 6 7 8
3 4 5 6 7 8
In the se ond ase we have: C (H ) = f2; 4g, D(H ) = f5; 6g and D (H ) = f5g.
4.2.4 Some Useful Properties
Property 4.2.5. Given n; s 2 N , s =
6 0, su h that n  2s, and H  f1; : : : ; ng.
The bije tive fun tion H is su h that for any i 2 dom( H ), H (i) i is the
minimum non-negative multiple of s, i. e. we have
H

Proof.

(i)
s

= min
(l j i + l  s 2 im( H )):
l2N

The proof follows from the the fa t that

(4.28)

is a restri tion of H .

Property 4.2.6. Given n; s 2 N , s 6= 0, su h that n  2s, and H  f1; : : : ; ng.


The inverse fun tion of H is su h that, for any j 2 im( H ), there exists a
non-negative integer mj su h that

(j ) = mj  s:
(4.29)
The proof follows from (4.19). In fa t for any j 2 im( H ) we have
1
1
(4.30)
H ( H (j ))
H (j ) = lj  s;
|
{z
}
j

Proof.

=j

where lj is a non-negative integer.



Let us denote by (H ) the set D(H ) n D (H ).

4.2.

77

THE ABSTRACT MODEL

4.2.5 Cardinality

The next two theorems give us the ardinality of the sets:


(fs + 1; : : : ; n + sg n (H + s)) n dom H ;
(4.31)
(f1; : : : ; ng n H ) n im H :
The meaning of these apparently obs ure sets will be ome lear in the next
se tion where they are interpreted in terms of fa tors of polynomials involved in
Zeilberger's algorithm that satisfy a ertain ondition (Gosper ondition).
Theorem 4.2.7. Given n; s 2 N , s 6= 0, su h that n  2s, H  f1; : : : ; ng.
Denoted by PH and RH the domain and image of the

H.

We have

j(fs + 1; : : : ; n + sg n (H + s)) n PH j = s j(H )j;


j(f1; : : : ; ng n H ) n RH j = s j(H )j:

(4.32)

By Theorem 4.2.4, we have


jPH j = jRH j = n s jC (H )j jD (H )j:
(4.33)
Moreover, sin e
H  f1; : : : ; ng;
PH  fs + 1; : : : ; n + sg n (H + s);
(4.34)
RH  f1; : : : ; ng n H;
we have
j(fs + 1; : : : ; n + sg n (H + s)) n PH j = j(f1; : : : ; ng n H ) n RH j =
= j(f1; : : : ; ngj jH j jRH j = n jH j (n s jC (H )j jD (H )j) = (4.35)
= n jC (H )j jD(H )j n + s + jC (H )j + jD (H )j = s j(H )j;

Proof.

Example 4.2.4.
n = 11, s = 3, H = f3; 5; 6; 9; 10g:

7 8 9 10 11

9 10 11 12 13 14

78

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

In this ase we have C (H ) = f3; 5; 6g, D(H ) = f9; 10g, D (H ) = f10g,


(H ) = f9g.
We see that the ardinality of the sets (fs +1; : : : ; n + sgn (H + s)) n dom( H )
and (f1; : : : ; ng n H ) n im( H ) is s j(H )j = 3 1 = 2:
Theorem 4.2.8. Given n; s 2 N , s 6= 0, su h that n  2s, H  f1; : : : ; ng. The
set (H ) = D(H ) n D (H ) is su h that:
0  j(H )j  s;
(4.36)
and
Proof.

j(H )j = s i f1; : : : ; ng = H:
(4.37)
The fa t that 0  j(H )j  s follows immediately from the de nition of

(H ) and from the fa t that D (H ) is a subset of D(H ).


We see that if f1; : : : ; ng = H then im(C (H ) ) = ; and therefore D (H ) = ;
whi h implies (H ) = D(H ) and j(H )j = s sin e D(H ) = fn s + 1; : : : ; ng.
On the other hand, j(H )j = s implies D (H ) = ; and D(H ) = fn s +
1; : : : ; ng. If we assumed that f1; : : : ; n sgn H were not the empty-set we would

have that

max(i j i 2 f1; : : : ; n sg n H ) + s 2 dom(C (H ) )


and its image would be in
D (H ) = im(C (H ) ) \ D(H );
whi h ontradi ts the fa t that D (H ) = ;.

4.2.6 Maximal Cardinality Property

(4.38)

We now prove that H is the bije tion between a subset of fs +1; : : : ; ngn (H + s)
and a subset of fs +1; : : : ; ngn H su h that ondition (4.27) holds, whose domain
and image have the largest possible ardinality.
Theorem 4.2.9. Given n; s 2 N , s 6= 0, su h that n  2s, and H  f1; : : : ; ng.
There exists no bije tion H : M ! N where
M  fs + 1; : : : ; ng n (H + s);
(4.39)
N  fs + 1; : : : ; ng n H;
su h that for any i 2 P , there exists a non-negative integer mi su h that
H (i) i = mi  s:
(4.40)
and dom( H ) ( M .

4.3.

SHIFT QUOTIENTS IN ZEILBERGER'S ALGORITHM

79

We noti e that
dom( H ) = (fs + 1; : : : ; ng n (H + s)) n C 1(H ) (D (H )):
(4.41)
We show that there annot be a bije tion H : M ! N su h that the ondition
(4.40) holds and su h that M  fs + 1;1: : : ; ng n (H + s), N  fs + 1; : : : ; ng n H
and that has any of the elements in C (H ) (D (H )) in its domain.
If this were not
the ase, by Property 4.2.5 and by the fa t that for any
1

i 2 D(H ), H (C (H ) (i)) 6= i, we would also have
H (C 1(H ) (i)) > C (H ) (C 1(H ) (i)) = i:
(4.42)
By (4.40) we have
H (C 1(H ) (i)) C 1(H ) (i) = m  s;
(4.43)
where m is a non-negative integer.
By Property 4.2.6 on the inverse fun tion
i C 1(H ) (i) = l  s;
(4.44)
where l is a non-negative integer.
Therefore from (4.42) we have
H (C 1(H ) (i))  i + s;
(4.45)
whi h is impossible be ause i  n s + 1 sin e i 2 D (H ).


Proof.

Example 4.2.5.
n = 7, s = 2 and H = f1; 4; 6g:

7 (next possible image)


outside the range

5 6 7 8 9
minimal distan e
Here we have C (H ) = f1; 4g, D(H ) = D (H ) = f6g.

4.3 Shift Quotients in Zeilberger's Algorithm


In this se tion we interpret the previous results in terms of linear fa tors of
polynomials involved in Zeilberger's algorithm.

80

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

4.3.1 Notation and De nitions

As in Chapter 1 (De nition 1.2.4) we de ne:


De nition 4.3.1. We will denote by F (n; k) a proper hypergeometri term, i.e.
QA
(a n + bik + i)!
k
F (n; k) = P (n; k)x QUi=0 i
(4.46)
(
u
n
+
v
k
+
w
)!
j
j
j
j =0
where ai, bi, i, uj , vj and wj are integers, x is a parameter, and where P (n; k) 2
Q [n; k.
Given a hypergeometri term F (n; k) in n and k, we denote by N and K the
shift operators whose a tion on F (n; k) is
Nsn;k = sn+1;k ; Ksn;k = sn;k+1 :
(4.47)
We denote byPdL the linear re urren e operator with polynomial oe ients
in n (free of k) i=0 zi (n)N i, with zi (n) 2 Q (n).
De nition 4.3.2. For any hypergeometri term F (n; k) we de ne the shift quotient of F (n; k) in n (respe tively in k) as follows:
Qn(F (n; k)) = F (Fn(+n; 1k;)k) ;
(4.48)
and
(4.49)
Qk (F (n; k)) = F (Fn;(n;k +k)1) ;
respe tively.
We denote by F^ (n; k)
QA
(a n + bi k + i)! :
k
F (n; k)=(P (n; k)x ) = QUi=0 i
(4.50)
(
u
n
+
v
k
+
w
)!
j
j
j
j =0
We will denote by num and den the operators that extra t respe tively numerators and denominators out of a rational fun tion f (n; k) 2 Q (n; k), with
n; k 2 Z, in normal form, i.e. given
p (n; k)
f (n; k) = 1
;
(4.51)
p (n; k)
2

with p1 (n; k); p2(n; k) 2 Q [n; k su h that g d(p1(n; k); p2(n; k)) = 1, we have
num f (n; k) = p1 (n; k); den f (n; k) = p2(n; k):
(4.52)
For the sole purpose of studying the degree it su es to onsider numerators
and denominators de ned up to multipli ative onstant oe ients.

4.3.

SHIFT QUOTIENTS IN ZEILBERGER'S ALGORITHM

81

De nition 4.3.3. We de ne a proper hypergeometri term F (n; k) to be nregular (k-regular) in n if and only if the numerator and the denominator of its
shift quotient in n (respe tively in k) have the same degree in n, i.e.

and

degn(num Qn(F (n; k))) = degn(den Qn(F (n; k)));

(4.53)

degn(num Qk (F (n; k))) = degn(den Qk (F (n; k))):

(4.54)

respe tively.
We de ne non-n-regular (non-k-regular) in n any term whi h does not satisfy
(4.53) ((4.54) respe tively).

The Binomial
Coe ient

n
The binomial oe ient k is n-regular in n but it is non-k-regular in n. In fa t
we have:
 
(4.55)
Qn( nk ) = n n +k +1 1
and
 
(4.56)
Qk ( nk ) = nk + k1 :
Example 4.3.2. Rational Fun tions
Any rational fun tion F (n; k) = p1(n; k)=p2(n; k), with p1 ; p2 2 Q [n; k is both
n-regular in n and k-regular in n. In fa t we have:
k)
p1 (n + 1; k) p2 (n; k)
Qn( pp1((n;
)
=

(4.57)
p2 (n + 1; k) p1 (n; k)
2 n; k )
and
p1 (n; k + 1) p2 (n; k)
k)
)
=

:
(4.58)
Qk ( pp1((n;
p2 (n; k + 1) p1 (n; k)
2 n; k )
Example 4.3.3. The Fa torial Fun tion
The fa torial term F (n; k) = n! is trivially k-regular in n but non-n-regular in n.
In fa t
(4.59)
Qn(n!) = (n +n! 1)! = n + 1:
Example 4.3.1.

4.3.2 Interpretation of the Model

With the next theorem and orollary we prove that the degree in n of some
polynomials involved in Zeilberger's algorithm an be bounded in a way whi h
is independent of the order d of the re urren e. We do this by interpreting the
abstra t model des ribed in the previous se tion in terms of fa tors of polynomials
breaking a ertain ondition.

82

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

In the sequel we will use the following notation:


A+ = fi j 0  i  A; ai > 0g; A = fi j 0  i  A; ai < 0g;
(4.60)
U + = fj j 0  j  U; uj > 0g; U = fj j 0  j  U; uj < 0g;
De nition 4.3.4. Given f 2 Z[n; k and i 2 N we de ne the i-rising fa torial of
f (n; k), denoted by f i , to be
fi =

i 1
Y
j =0

(f + j ); for i > 0;

De nition 4.3.5. Given f 2 Z[n; k and i 2 N


of f (n; k), denoted by f i, to be
fi
Lemma 4.3.1.

= (f
j =0

j );

for i > 0;

By de nition of F^ (n; k) we have

(4.61)

we de ne the i-falling fa torial


f 0 = 1:

den Qn(F^ (n; k)) must be a divisor of


Y
Y
(uj n + vj k + wj + 1)uj  (ai n + bi k + i)ai :

j 2U

Proof.

i 1
Y

f 0 = 1:

i2A

(4.62)
(4.63)

Q
(u n + v k + w )!
(
a
n
+
b
k
+

+
a
)!
i
i
i
i
Qn(F^ (n; k)) = Q i2A (u n + v k + w + u )!  Qj2U (aj n + bj k + j)! 
j
j
j
j
i
i
i
j 2U
Q i2A
Q
(u n + v k + w )!
 Q i2A ((uainn++vbikk ++ w i ++aui)!)!  Qj2U (aj n + bj k + j)! =
j
j
j
j
i
i
i
j 2U
i2A
Q
Q
a
i
(
uj n + vj k + wj )uj
(
ai n + bi k + i + 1)
j
2U
i
2A
= Q (u n + v k + w + 1)uj  Q (a n + b k + )ai :
j
j
j
i
i
i
j 2U
i2A
(4.64)
Taking the denominator ompletes the proof.

Q

In the following we will refer to the linear fa tors in n and k of den Qn(F^ (n; k)),
i.e. those linear fa tors in n in k from
Y
Y
(uj n + vj k + wj + 1)uj  (ain + bik + i )ai
j 2U +

i2A

that are not an eled in Q(F^ (n; k)), simply as linear fa tors of den Qn(F^ (n; k)).
We will refer to the
fa tors
of
N h den Qn (F^ (n; k)), for h = 0; 1; : : : ; d 1,
Qd linear
as linear fa tors of h=01 (N h den Qn(F^ (n; k))).

4.3.

SHIFT QUOTIENTS IN ZEILBERGER'S ALGORITHM

83

Algorithm 4.1 Gosper Form


Input: a(n; k)=b(n; k) 2 Q (n; k), with a(n; k); b(n; k) 2 Q [n; k
Output: p(n; k); q (n; k); r(n; k) 2 Q [n; k su h that

and
1:

2:

3:

4:

a(n; k) p(n; k + 1) q (n; k)


= p(n; k)  r(n; k + 1) :
b(n; k)

(4.65)

g d(q(n; k); r(n; k + j )) = 1;

(4.66)

for all j  1, j 2 N .
i := 0;
p0 (n; k) := 1;
q0 (n; k) := a(n; k);
r0 (n; k) := b(n; k 1).
while there exists j 2 N su h that
g d(qi(n; k); ri(n; k + j )) = f (n; k) 6= 1;
do
qi+1 (n; k) := qi (n; k)=f (n; k);
ri+1 (n; k) := ri (n; k)=f (n; k j + 1);
pi+1 (n; k) := pi (n; k)  f (n; k 1)j 1 ;
i := i + 1.
return (pi (n; k); qi (n; k); ri (n; k))

(4.67)

84

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

De nition 4.3.6. Given a rational fun tion a(n; k)=b(n; k) 2 Q [n; k, we de ne


the Gosper form of a(n; k)=b(n; k) to be the triplet (p(n; k); q(n; k); r(n; k)) of
polynomials in Q [n; k su h that

and su h that

a(n; k) p(n; k + 1) q (n; k)


= p(n; k)  r(n; k + 1) :
b(n; k)

(4.68)

g d(q(n; k); r(n; k + j )) = 1; 8j > 0; j 2 N :

(4.69)

We refer to the ondition (4.69) as Gosper ondition .


We refer to the additional ondition on p, q and r
g d(p(n; k + 1); r(n; k + 1)) = 1;
(4.70)
g d(p(n; k); q(n; k)) = 1:
as Petkovsek ondition [Pet92.
We refer to the problem of nding y(n; k) 2 Q [n; k su h that
p(n; k) = q (n; k)y (n; k + 1) r(n; k)y (n; k);
(4.71)
as Gosper equation and we all y(n; k) Gosper polynomial .
More details on the Gosper form an be found in the rst hapter. We also
refer to [Gos78, [Pau95, [PS95, [Zei90, [Zei91, [GvzG99, pages 622{639 and
[GKP94, pages 223{241.
Remark 4.3.1. Imposing to the polynomials in Gosper form the additional
Petkovsek ondition (4.70) produ es a unique Gosper form up to invertible elements (Gosper-Petkovsek form) .
Theorem 4.3.2. Algorithm 4.1 generates the Gosper form of a rational fun tion.

For the proof we refer to [PWZ97, pages 79{84.


We will prove the next theorem by interpreting the ondition (4.27) on the
fun tion H as a violation of the Gosper ondition.
Theorem 4.3.3. If the order d of L is su h that
d  M (F (n; k));

(4.72)

4.3.

SHIFT QUOTIENTS IN ZEILBERGER'S ALGORITHM

where

M (F (n; k)) = max(max(d2jvj j=uj e); max(d2jbi j=jaije));


i2A

j 2U +

85
(4.73)

then, the number of linear fa tors f in

t(n; k) :=

dY1

(N h den Qn(F^ (n; k)))

h=0

(4.74)

su h that

g linear fa tor in Kt(n; k) su h that


f = K m g for some m 2 N ;
is bounded by

X
j 2U +

Proof.

jvj j +

By Lemma 4.3.1, we an write


t(n; k) =

j;d
Y
Y A

j 2U + s=1
i;d
Y
Y B
i2A t=1

X
i2A

(4.76)

jbi j;

(uj n + vj k + wj + fj;s)

(ai n + bi k + i + 1

(4.75)

gi;t );

(4.77)

where Aj;d, Bi;d are non-negative integers and fj;s, gj;t are non-negative distin t
integers su h that
1  fj;s  d  uj ; 1  gi;t  d  jaij:
Choosing d  M (F (n; k)) (4.73) guarantees
d  uj  2  jvj j; 8j 2 U + ;
(4.78)
and
d  jai j  2  jbi j; 8i 2 A :
(4.79)
Hen e, if we ex lude the trivial ases vj = 0 and bi = 0, we are under the
hypotheses of Theorem 4.2.7 and Theorem 4.2.8 whi h guarantee that for ea h
fa tor (ai n + bi k + i)dai , i 2 A and (uj n + vj k + wj )duj , j 2 U +, respe tively at
most jbij and jvj j linear fa tors satisfy the ondition in (4.75). Therefore a bound
for the number
of linear fa tors in Kt(n; k) that do not violate the ondition
(4.75), is Pj2U jvj j + Pi2A jbi j.

+

86

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

Example 4.3.4.

If we take

F (n; k) =

(2n + k 1)! ;
(4n + 2k)!

and d = 2 we have:
(4n + 2k)! =
Qn(F^ (n; k)) = Qn(F (n; k)) = (4(2nn++2kk++1)!
4)! (2n + k 1)!
= (4n + 2k + 1)2(4n2+n +2kk+ 3)(4n + 2k + 4) :
(4.80)
Therefore
t(n; k) = 4(4n + 2k + 1)(4n + 2k + 3)(4n + 2k + 4)
(4.81)
(4n + 2k + 5)(4n + 2k + 7)(4n + 2k + 8);
where
dY1
t(n; k) := (N h den Qn (F^ (n; k)));
(4.82)
h=0
and
Qk (1=t(n; k)) =
(4.83)
1)(X + 3)(X + 4)(X + 5)(X + 7)(X + 8) :
= ((XX ++3)(
X + 4)(X + 6)(X + 7)(X + 9)(X + 10)
where X = 4n + 2k.
The violations of the Gosper ondition (in luding an ellations) between fa tors in the numerator and denominator of
t(n; k)
Qk (1=t(n; k)) = Kt
(4.84)
(n; k) ;
are shown in the following diagram des ribing H , de ned in De nition 4.2.3,
with H = f2; 6g, n = 8 and s = 2:
1

10

4.3.

87

SHIFT QUOTIENTS IN ZEILBERGER'S ALGORITHM

The set H = f2; 6g des ribes the missing fa tors in t(n; k) (i.e. 4n + 2k + 2,
4n + 2k + 6). The ir led integers are the elements of the sets
(f1; : : : ; ng n H ) n im ( H );

(4.85)

and

(fs + 1; : : : ; n + sg) n (H + s)) n dom ( H ):


(4.86)
namely those integers in the upper set (i.e. f1; : : : ; 8g) that are nor in a \hole" (2
or 6) nor in the the image of H (i.e. f3; 5; 7; 8g), and those integers in the lower
set (i.e. f3; : : : ; 10g) that are nor in a \shifted hole" (4 or 8) nor in the domain
of H (i.e. f3; 5; 6; 7g), respe tively. The rst ones orrespond to the fa tors of
the polynomial q(n; k) in the Gosper form of Qk (1=t(n; k)) and the latter to the
fa tors in the polynomial r(n; k) in the Gosper form of Qk (1=t(n; k)).
Theorem 4.2.7 and Theorem 4.2.8 bound the ardinality of these sets and
therefore also the degree in n of q(n; k) and r(n; k) by s = 2.
In the following we will use the following notation
Q^ n = Qn(F^ (n; k)); Q^ k = Qk (F^ (n; k))

(4.87)

Lemma 4.3.4. For any d 2 N we have

d
X
i=0

d
X

zi (n)N i )F (n; k) =(

i=0

zi (n)(N i P (n; k))

 Qd

1
i=0

Proof.

i 1
Y
j =0

N j num Q^ n

 xk F^ (n; k):
^
( den Qn)

d 1
Y
j =i

N j den Q^ n )

Ni

(4.88)

We noti e that

(n; k)  N F^ (n; k) = NP (n; k)  Q^ :


= NP
n
P (n; k) F^ (n; k)
P (n; k)
Therefore, using (4.89) we get
Qn =

NF (n; k)
F (n; k)

(4.89)

88

CHAPTER 4.

d
X
i=0

=(

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

zi (n)

d
X
i=0
d
X

Ni

)F (n; k) = (

zi ( n )

i 1
Y

Nj

j =0
N iP

d
X
i=0

zi (n)

i 1
Y
j =0

N j Qn )F (n; k) =

NP (n; k) j ^
 N Qn )F (n; k) =
P (n; k)

i 1
(n; k) Y
num Q^ n )F (n; k) =
Nj
P (n; k) j =0 den Q^ n
i=0
d
i 1
X
Y
^
i
= ( zi (n)N P (n; k) N j num Q^ n )  xk F^ (n; k) =
den Qn
i=0
j =0

=(

=(

d
X
i=0

zi (n)(N i P (n; k))

 Qd


zi (n)

1
i=0

i 1
Y
j =0

N j num Q^ n

 xk F^ (n; k):
^
( den Qn)

d 1
Y
j =i

(4.90)

N j den Q^ n )

Ni

Corollary 4.3.5. If the order d of L is su h that


d  max(max(d2jvj j=uj e); max(d2jbi j=jai je));
i2A

j 2U +

(4.91)

then the Gosper form (p(n; k); q (n; k); r(n; k)) of Qk (LF (n; k)), will be su h that
the degrees of q (n; k) and r(n; k) in n are bounded by
X
X
degn(num(Q^ k )) + ( jvj j + jbij);

and

j 2U

i2A

X
X
degn(den(Q^ k )) + ( jvj j + jbi j);
j 2U +

respe tively.

i2A

(4.92)
(4.93)

From Lemma 4.88 and from the distributivity of the shift quotient we
have that
dY1
i 1
d
Y
X
Qk (LF (n; k)) = Qk ( zi (n)(N i P (n; k)) N j num Q^ n N j den Q^ n )
j =i
j =0
i=0
(4.94)
dY1
 Qk (1=( N h den Q^ n))  x  Q^ k ;
Proof.

h=0

We noti e the following fa ts:

4.3.

SHIFT QUOTIENTS IN ZEILBERGER'S ALGORITHM

89

to the
 Qk (1=(Qdh=01 N h den Q^ n)), by Theorem 4.3.3, ontributes
P
P degree in
n of q (n; k) and r(n; k) by a degree bounded by j 2U jvj j + i2A jbi j;
+

 xQ^ k gives a ontribution to q(n; k) and r(n; k) with degree in n respe tively

degn num(Q^ k ) and degn den(Q^ k );


 Qk (Pdi=0 zi(n)(N i P (n; k)) Qji =01 N j num Q^ n Qdj=i1 N j den Q^ n) violates the
Gosper ondition (see (4.69)) be ause it is the shift quotient in k of a
polynomial, and therefore does not ontribute to the degree in n of either
q (n; k) or r(n; k).

Remark 4.3.2. While Corollary 4.3.5 holds for any Gosper form, ondition (4.70)
(Petkovsek ondition) an produ e a Gosper form with lower degree polynomials.
4.3.3 Gosper Equation

In the next two theorems we nd onditions under whi h it is possible, at least


heuristi ally, to nd a relation between the highest degree in n of zi (n) for 0 
i  d 1 and of the oe ients yi (n) with respe t to k of the Gosper polynomial
y (n; k).
In the following we assume that L is su h that LF (n; k) is Gosper-summable.
We denote the Gosper form of LF (n; k) by (p(n; k); q(n; k); r(n; k)).
We also introdu e the following de nitions:
 := max (degn (zi (n))); := degn (y (n; k));
0id
(4.95)
:= degn (q (n; k)); := degn (r(n; k)); := degn (num Q^ n );
where y(n; k) is the Gosper polynomial. We denote the oe ient of ki in y(n; k)
by yi(n).
We denote by (p(n; k); q(n; k); r(n; k)) the Gosper form of
dY1

Qk (1=( N h den Q^ n))  x  Q^ k :


h=0

For a given polynomial a(n; k) 2 Q [n; k we denote by L oe n(a(n; k)) the


leading oe ient of a(n; k) with respe t to n, i.e. the oe ient of highest degree
with respe t to n.

90

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

Remark 4.3.3. Sin e LF (n; k) is assumed to be Gosper-summable we have  


0. Sin e y(n; k) annot be identi ally zero we must also have  0.
Lemma 4.3.6. Given F (n; k) proper hypergeometri , n-regular in n, then the
degree in n of p(n; k) is bounded by:

degn(p(n; k)) +  + degn(P (n; k)) + d  :


(4.96)
Qk (Pdi=0 zi (n)(N i P (n; k)) Qij=01 N j num Q^ n Qdj=i1 N j den Q^ n) violates
the Gosper ondition be ause it is the shift quotient of a polynomial.
Then the Gosper form (p(n; k); q(n; k); r(n; k)) of LF (n; k) has the following
form:
p(n; k) = p0 (n; k)  p(n; k); q (n; k) = q(n; k); Kr(n; k) = K r(n; k): (4.97)
where
Proof.

p0 (n; k) =

d 1
X
i=0

zi (n)(N i P (n; k))

i 1
Y
j =0

N j den Q^ n 

dY1
j =i

N j num Q^ n ;

(4.98)

whose degree is bounded by  + degn(P (n; k)) + d  .



Lemma 4.3.7. Let F (n; k) be proper hypergeometri and non-k-regular in n, and
let us denote by (p(n; k); q (n; k); r(n; k)) the Gosper form for LF (n; k). Then
q (n; k)y (n; k + 1) r(n; k)y (n; k) has degree in n:
+ max( ; ):
(4.99)
We noti e that the hypothesis of non-k-regularity in n of F (n; k) together with Qthe fa t that 1=(Qdh=01 (N h den Q^ n)) is k-regular in n implies that
F^ (n; k)  1=( dh=01 (N h den Q^ n )) is non-k-regular in n, from whi h follows 6= .
Therefore there is no an ellation between the leading oe ients of the polynomials q(n; k)y(n; k + 1) and r(n; k)y(n; k). 
Proof.

Theorem 4.3.8. Given F (n; k) proper hypergeometri , n-regular in n. If


X

L oe n(zi ) L oe n(P (n; k)) L oe n(den Q^ n)i  L oe n(num Q^ n )d i 6= 0


ij degn (zi )=M
(4.100)
and either F (n; k) is non-k-regular in n,
or

4.3.

SHIFT QUOTIENTS IN ZEILBERGER'S ALGORITHM

91

F (n; k) is k-regular in n and


X

L oe n(q) L oe n(yj (n))(k + 1)j L oe n(r) L oe n(yj (n))kj 6= 0;


j j degn (yj )=M 0
(4.101)
where M and M 0 are the highest degrees in n of the zi (n) for 0  i  d 1 and
y (n; k)'s, respe tively, then we have
 + degn (p(n; k)) + degn (P (n; k)) + d  = + max( ; ):
(4.102)
We see that the rst ondition (4.100) guarantees that the left hand side
of the Gosper equation (4.71), i.e. p(n; k) has degree exa tly  + degn(p(n; k)) +
degn(P (n; k)) + d  .
The se ond ondition guarantees that the degree in n of the right hand side,
i.e. of q(n; k)y(n; k + 1) r(n; k)y(n; k) is + max( ; ).

Theorem 4.3.9. Given F (n; k) proper hypergeometri , n-regular in n, non-kProof.

regular in n, then we have

 + degn (p(n; k)) + degn (P (n; k)) + d   + max( ; ):

(4.103)
By Lemma 4.3.6, the fa t that F (n; k) is non-k-regular in n guarantees
that the right hand side of the Gosper equation (4.71), i.e.q(n; k + 1)y(n; k)
r(n; k)y (n; k) has degree in n exa tly + max( ; ).
By Lemma 4.3.7, the degree in n of the left hand side, i.e. p(n; k) is at most
 + degn (p(n; k)) + degn (P (n; k)) + d  :


Proof.

4.3.4 Lower Bounds on Degrees

We now use the previous result to get lower bounds on the degree in n of the
oe ients zi (n), for 0  i  d 1, of the linear re urren e operator L, and on
the Gosper polynomial y(n; k).
De nition 4.3.7. Let us de ne:
D(F (n; k); d) = max( ; ) (degn (p(n; k)) + degn (P (n; k)) + d  ): (4.104)
Remark 4.3.4. By Corollary 4.3.5, we have that and an be bounded independently of d, whereas degn(p(n; k)) + degn(P (n; k)) + d  grows with d when
 1. Therefore, if  1, for d big enough we expe t D(F (n; k); d) to be
negative.

92

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

Theorem 4.3.10. Given F (n; k) proper hypergeometri , n-regular in n, nonk-regular in n, then the following lower bound on the degree in n of zi (n), for
0  i  d 1, and of the oe ients yi(n) of y(n; k) with respe t to k must hold:
  D(F (n; k); d):

(4.105)

  D(F (n; k); d);  D(F (n; k); d):

(4.106)

It follows from Theorem 4.3.9, and from the fa t that


  + D(F (n; k); d)  D(F (n; k); d);
be ause the Gosper polynomial annot be identi ally zero.

Theorem 4.3.11. Given F (n; k) proper hypergeometri , n-regular in n, then
if ondition (4.100) holds and either F (n; k) is non-k-regular in n or ondition

Proof.

(4.101) holds, then we have

It follows from Theorem 4.3.8, and from the fa t that


 = + D(F (n; k); d)  D(F (n; k); d);
(4.107)
=  D(F (n; k); d)  D(F (n; k); d);
be ause the Gosper polynomial annot be identi ally zero and not all the zi (n)
an be zero.


Proof.

4.3.5 Some Examples

We run Zeilberger's algorithm


p implemented as des ribed in Chapter 1 on in reasn
ing powers of binomials k , for p = 1; 2; : : : ; 7 sin e the order d of the re urren e
found by the algorithm is related to the power p by the simple formula d = bp=2 :
power order  
1
1 1 0 1 0 0 0
2
1 2 0 2 1 1 0
3
2 3 0 3 5 2 3
4
2 4 0 4 7 3 4
5
3 5 0 5 16 6 10
6
3 6 0 6 20 9 11
7
4 7 0 7 37 16 21
We observe how  grows in this ase with the order of the re urren e.

4.4.

93

CONCLUSION

In all the presented examples we have


degn(p(n; k)) = 0;
degn(P (n; k)) = 0:
We noti e that

np
k

(4.108)

with p 2 N is n-regular in n and non-k-regular in n:


 p
p
Qn( nk ) = (n(n +k +1)1)p ;
 p
(4.109)
(
n k)p
n
Qk ( k ) = (k + 1)p :

Some other examples:


term
order 
n!
2 2 0 1 1 1
k!(m+k)!(n m 2k)!
(n k)!
2 2 1 1 0 0
k!(n 2k)!
2k n 2
2 2 1 2 3 2
k k

0
0
1

4.4 Con lusion


The main result a hieved in this hapter is a ombinatorial model that des ribes
the Gosper ondition and therefore the Gosper form. By this model we know that
the degree of ertain polynomials (q(n; k) and r(n; k)) does not grow with the
order of the re urren e (see Corollary 4.3.5). From this, under some hypotheses
on the term (see (4.91)), we an estimate the di eren e between the degree (in
n) of the oe ients of the linear re urren e (i.e. zi ) and the oe ients (i.e. yi )
of the Gosper polynomial.
We an apply this result to get lower bounds on the degree of solutions of related systems of linear equations. This is useful when omputing the omponents
of the solutions by polynomial interpolation. How to use this result together with
rational fun tion interpolation still has to be investigated and some preliminary
experiments are en ouraging. We ould use interpolation only on low degree
omponents and standard symboli Gaussian elimination for the remaining omponents.
The main limitation of this result on the degree of the omponents of the solutions is given by the hypotheses on the term (F (n; k)). Su h hypotheses are often
ful lled when Zeilberger's algorithm is implemented as des ribed in Chapter 1,
but an be ome a serious restri tion when Zeilberger's algorithm is implemented
in a di erent way (for details on how to \tune" Zeilberger's algorithm we refer

94

CHAPTER 4.

LINEAR SYSTEMS IN ZEILBERGER'S ALGORITHM

to [Rie01). For instan e, when summing


n  
X
n
k=0

(4.110)

we ould rewrite the problem as follows


n
n   X
n
X
X
n!
n
1 ;
=
=
n!
(4.111)
k
k
!(
n
k
)!
k
!(
n
k
)!
k=0
k=0
k=0
where 1=(k!(n k)!) is simpler to sum be ause it generates
a simpler system of
n
linear equations but it is no longer n-regular in n as k , and therefore does not
satisfy the onditions of theorems 4.3.9, 4.3.8, 4.3.10, 4.3.11.
Further study will be ne essary to implement these results and extend them
to more general ases.

Part III
Polynomial Arithmeti Library

95

Chapter 5
Combinatorial Interpretation of
Division

5.1 Introdu tion


We des ribe the re urren e for the oe ients of the polynomial y(x) su h that
p(x)  y (x)  1 mod xl , where l is a non-negative integer and p(x) is an invertible
polynomial over a ring R, i.e. x - p(x), for whi h therefore y(x) exists. We will use
a trans endental extension of R as a tool to study the re urren e. Besides, we give
a ombinatorial interpretation of the solution y(x) that relates the oe ients of
y (x) with non-negative integer ompositions.

5.2 De nitions
Let us denote by K a eld ontaining Q , and let R either be equal to K or to
the ring K [v1; v2 ; : : : ; vr of multivariate polynomials over K .
Let a0 , a1, ... an be trans endental elements over the ring R and let R =
R(a0 ; a1 ; : : : ; an ) be the trans endental ring extension over R with respe t to a0 ,
a1 , ... an .
Given these trans endentals ai, let a(x) 2 R [x be
a(x) =

n
X
i=0

ai xi :

Hen e deg(a) = n.
Let us onsider a polynomial b(x) 2 R[x with deg(b) = m and bm 2 K n f0g:
b(x) =

m
X
i=0

97

bi xi

98

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

and the polynomials q(x), r(x) 2 R [x, su h that:


a(x) = b(x)  q (x) + r(x)
(5.1)
and either
r(x) = 0
(5.2)
or
deg(r) < deg(b):
(5.3)
The trans endentals a0 ,...,an are a tool to study a re urren e related to b(x).
Remark 5.2.1. The existen e and uniqueness of q (x), r(x)
the fa t that bm , being an element of K n f0g, is invertible.

are guaranteed by

Notation

 i;j denotes the Krone ker delta fun tion, whi h is 1 if i = j and 0 otherwise.
 [xl is the operator whi h extra ts the oe ient of xl from a polynomial

expanded with respe t to x.

De nition 5.2.1. Given p(x) 2 R [x and d 2 Z su h that d  deg(p), we de ne


the d-reversed polynomial of the polynomial p(x), denoted by revd (p(x)), to be

revd(p(x)) = xdp(1=x):

(5.4)

Unless di erently spe i ed, the j -th oe ients of a, b, q, r and


of other polynomials will be denoted with the orresponding indexed letter, i.e.
qj = [xj q (x). Coe ients with inde es outside the range will be assumed to be
zero.

Convention:

Given the equality (5.1), we de ne


Cb (i) := [an qn m i ;
i.e. Cb (i) is the oe ient of an in [xn m i q(x).
De nition 5.2.2.

When b is lear from the ontext we use C (i) instead of Cb(i).

5.3.

99

EXISTENCE OF THE INVERSE

5.3 Existen e of the Inverse

Property 5.3.1. For any polynomial p(x) 2 R[x (or respe tively R [x), deg(p) =
m, with p0 6= 0, and for any non-negative integer l, there exists always a polynomial y (x) 2 R[x (respe tively R [x) su h that
p(x)  y (x)  1
Moreover,
Proof.

mod xl :

(5.5)

y 0 = p0 1 :

(5.6)

The ondition (5.5) is equivalent to


l 1
X

k
X

k=0

i=0

pi yk

xk = 1:

(5.7)

Comparing the oe ients with respe t to x yields a system of linear equations


in triangular form:
p0 y0
= 1
p1 y0 + p0 y1
= 0
(5.8)
p2 y0 + p1 y1 + p0 y2 = 0
:::::::::::::::::

:::

in whi h the oe ient of the highest variable in the ordering y0 < y1 <    < yl 1
is always p0. Therefore su h a system an be solved by ba k-substitution, that
yields
y 0 = p0 1 ;
(5.9)
whi h proves the se ond statement (5.6) , and for all 1  k  l 1 we have
k
X
1
yk =
pi yk i; k 2 N n f0g:
p
0

i=1

(5.10)

The re urren e (5.10) gives an algorithm for omputing the


is zero for i  0 and i  m, su h algorithm performs O(l  m)
multipli ations in the ground eld.

Remark 5.3.1.
inverse. Sin e pi

100

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

5.4 Relation between C and q

For the sake of simpli ity we will onsider bm = 1 in the following. The more
general ase when bm is an arbitrary element of K n f0g an be redu ed to the
ase bm = 1 by dividing the oe ients of b(x) by the leading oe ient.
We will need the following lemmas to show how C (i) gives the ne essary
information to invert the m-reversed of b(x) = Pmi=0 bixi 2 R[x:
Lemma 5.4.1. For any non-negative integer i, the oe ients of the quotient of
a(x) divided by b(x) an be expressed by the following formula:
qn
Moreover, qn

i = an

i 1
X

k=max (0;i m)

bm

(5.11)

i+k qn m k :

is linear in an , an 1 , ..., an i .

m i

The proof of the above formula follows immediately from the orre tness
of the s hool division algorithm. In fa t this formula des ribes in a re ursive
fashion a step of the s hool division algorithm:
Proof.

an xn m + (an
+ :::
( an

an xn

xn

a n bm

xn m

1)

+ (an

an bm

(an

an bm

bm

1)

1)

xn m

+ q1 x + q0 =
+ an

xn

+ an

xn

+ an bm

(an

a n bm

(an

1
1

an bm

xn

+ an bm

1)

xn

xn

1)

xn

+   + a0 ) (xm + bm
2

xm

+   + b0 )

+ :::

xn

+ (an

an bm

2)

+ (an

an bm

1)

+ :::

bm 1 xn

+ :::

an bm 2 (an 1 an bm 1 )bm 1 ) xn 2 + : : :
: : : : : : : : : : : : : : : : : : : : : : : : : : :
(an

Sin e b(x) 2 R[x, the linearity of qn m i is immediately proved by indu tion


on i.

Lemma 5.4.2. For any h 2 f1; 2; : : : ; ng and for any non-negative integer i, we
have
[ah 1qn m i 1 = [ahqn m i :
(5.12)
The statement is true when i = 0 be ause by Lemma 5.4.1 (5.11) we
have qn m = an and qn m 1 = an 1 anbm 1 and therefore it follows that
Proof.

5.4.

RELATION BETWEEN

AND

101

[ah 1 qn m 1 = [ah 1(an 1 anbm 1 ) = h;n = [ahan = [ahqn m :


Assuming that the statement holds for values less than a ertain positive i,
we prove it for i.
By Lemma 5.4.1 (5.11), we have:
[ah 1qn m (i+1) =
=[ah 1(an
=h;n
=h;n

=h;n

=h;n

=[ah(an

i
X

(i+1)

i
X

k=max (0;i+1 m)

k=max (0;i+1 m)

bm i
|

=0

k=max (0;i m)
i 1
X
k=max (0;i m)
i 1
X

bm

[a{zh 1 qn

i 1
X

bm

i+k

(i+1)+k

[ah 1qn

m
}

k=max (1;i+1 m)

qn

i +k a h

bm

i +k a h q n m k

bm

i+k qn m k

)=

bm

m (k+1)

m k

m k

i
X

bm

k=max (0;i m)

qn

i+k

[ah 1qn

m k

(5.13)

) = [ahqn

m i:

Theorem 5.4.3. The oe ients of the quotient q (x) are given by the following
formula:
ql =

nX
m l

an j C (n m l

j =0
Pn m
the polynomial i=0 C

Moreover,
ulo xn m+1 , i. e.

nX
m
i=0

Proof.

j ):

(5.14)

(i)xi is the modular inverse of revm(b) mod-

C (i)xi  revm (b)

mod xn

m+1 :

(5.15)

By de nition of C (i) and by Lemma 5.4.2 (5.12) we have that


C (n m l j ) = [an ql+j = [an j ql :
(5.16)

102

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

By Lemma 5.4.1 (5.11), we know that ql is linear in an, an 1, ..., am+l . Therefore we have:
ql =

nX
m l
j =0

an

j  [an j ql =

nX
m l
j =0

a n j C (n m l

j ):

(5.17)

In order to prove the se ond part of the lemma, we noti e that, by the previous
statement (5.17), we must have
nX
m

revn(a) 


nX
m
l=0

i=0

qn

C (i)xi 

nX
m

l
X

l=0

j =0

an j C (l

 revn m(q) mod xn

l
m lx

j ) xl 
m+1 :

(5.18)

By the existen e of revm(a) 1 , proved in Property 5.3.1, we also have


nX
m
i=0

C (i)xi  revn (a)

 revn m(q) mod xn

m+1 :

(5.19)

Applying revn to a yields, be ause of (5.1),


revn(a) = revm(b)  revn m(q) + xn m+1 revm 1 (r);
(5.20)
and therefore
revn(a)  revm(b)  revn m(q) mod xn m+1 :
(5.21)
Hen e by the existen e of revm(b) 1 , guaranteed by Property 5.3.1, we also
have
revm (b) 1  revn(a) 1  revn m(q) mod xn m+1 :
(5.22)
whi h, with the previous ongruen e (5.19), ompletes the proof.


5.5 General Re urren e for C (i)

Theorem 5.5.1. The sequen e C (i) satis es the following m-th order linear re urren e:
8
>
<

0;
C ( i ) = 1;
> P
:

i 1
k=max (0;i

if i < 0;
if i = 0;
m) bm i+k C (k ); if i > 0:

(5.23)

5.6.

LIFTING TO THE

Proof.

B (X ) CASE

103

For any negative i we learly have:


C (i) = [an qn

= [an0 = 0:
From Lemma 5.4.1 (5.11) we have the following re urren e equation for qn
qn

m i

= an

m i

i 1
X
k=max (0;i m)

bm

i+k qn m k :

m i

(5.24)

Applying [an to both sides of this re urren e ompletes the proof.



Remark 5.5.1. Theorem 5.5.1 an be also proved by using the fa t that the C (i)
are the oe ients of the inverse of revm(b) as seen in Theorem 5.4.3 (5.15) and

therefore satisfy the re urren e (5.10) shown in the proof of the Property 5.3.1,
whi h is, up to a hange in the indi es the same as (5.23).
Remark 5.5.2. This m-th order re urren e des ribes an algorithm for omputing
the oe ients C (i) of the modular inverse of revm (b(x)), whi h omputes ea h
oe ient by m multipli ations in R.

5.6 Lifting to the b(x ) Case

Here we show how Cb(x) an be used to onstru t Cb(x ), for any positive integer .
Remark 5.6.1. Cb(x ) (i) is, by Theorem 5.4.3 (5.15), the oe ient of degree i
in the inverse of revm (b(x )).
Theorem 5.6.1. For any moni polynomial b(x) and any positive integer we
have
Cb(x ) (i) =

Cb(x) (i= ); if i  0 mod ;


0;
otherwise:

(5.25)

Let us denote Cb(x) and Cb(x ) by C and C , respe tively.


By Theorem 5.4.3 (5.15) we have that

Proof.

nX
m
i=0

(C (i)xi )  revm (b(x))  1 mod xn

m+1 :

Therefore, by de nition of revm (5.4), substituting x with x , we have

(5.26)

104

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

nX
m
i=0

(C (i)x i )  rev m (b(x ))  1 mod x (n

and, sin e for any positive , (n

(5.27)

m + 1)  n m + 1, we also have

nX
m
i=0

m+1) ;

(C (i)x i )  rev m (b(x ))  1 mod xn

m+1 :

(5.28)

Moreover, by Theorem 5.4.3 (5.15) applied to C we have that


nX
m
i=0

(C (i)xi)  rev m (b(x ))  1 mod xn

m+1 :

(5.29)

Hen e, from (5.28) and (5.29) we get


nX
m
i=0

( (i) ) =
C

xi

nX
m
i=0

(C (i)x i ):

(5.30)

Comparing the oe ients with respe t to x ompletes the proof.

5.7 Combinatorial Meaning


De nition 5.7.1. A omposition of a non-negative
integer i is a sequen e [p1 ,
Pn
p2 ,...,pn of positive integers su h that j =1 pj = i. By onvention the empty

sequen e [ is the only omposition of 0.


For any non-negative integer i, we denote by Comp(i) the set of all the ompositions of i.
De nition 5.7.2. For any non-negative integers i and j , we de ne the on atenation of Comp(i) with j , denoted by Comp(i)jj , as the set of sequen es obtained
from Comp(i) by appending j to the end of all the sequen es ( ompositions of i)
in Comp(i).
Example 5.7.1.
For i = 3 and j = 5 we have:

Comp(3) = f[1; 1; 1; [2; 1; [1; 2; [3g


Comp(3)j5 = f[1; 1; 1; 5; [2; 1; 5; [1; 2; 5; [3; 5g

(5.31)

5.8.

105

BINOMIAL CASE

Corollary 5.7.1. For any non-negative integers m and i we have:


Cb(x) (i) =

t2Comp(i) 2 t

bm

);

(5.32)

where 2 means being a omponent of t.

This an be proven by indu tion on i and by using the re ursive formula


(5.23) for C (i):
From (5.23) we have C (0) = 1 = Pt2f[g Q 2t ( bm ).
The indu tion step is proven by the fa t that the set Comp(i) is given by

Proof.

Comp(i) = [0k<i Comp(k)j(i k);


(5.33)
where Comp(k)j(i k) orresponds to the summand bm i+k C (k) in the formula
(5.23).

Example 5.7.2.

Let us see how the ompositions of 4 an be written in terms of ompositions of


0, 1, 2 and 3:
Comp(4) = Comp(0)j4 [ Comp(1)j3 [ Comp(2)j2 [ Comp(3)j1 =
= f[gj4 [ f[1gj3 [ f[1; 1; [2gj2 [ f[1; 1; 1; [1; 2; [2; 1; [3gj1 =
(5.34)
= f[4; [1; 3; [1; 1; 2; [2; 2; [1; 1; 1; 1; [1; 2; 1; [2; 1; 1; [3; 1g:

5.8 Binomial Case


The previous
formula
has
an
interesting
spe ial
ase
when
b(x) = (x d)m , i.e.

bi = mi ( d)m i :
Corollary 5.8.1. For any non-negative integers m; i and d 2 K n f0g we have:
C(x
Proof.

d)m

(i) =

t2Comp(i) 2 t

(( 1)

+1 d

 

)=

m+i
i

By Corollary 5.7.1 we have


C(x

d)m

(i) =

t2Comp(i) 2 t
m+i 1 i

(( 1)

+1 d

1  di;

 

m
):

We prove that C(x d)m (i) = i  d by indu tion on i.


By Theorem 5.5.1 (5.23) we have

(5.35)
(5.36)

106

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

C(x

(0) = 1 =

1  d0:

m+0

0
We now assume that for a ertain positive i, C(x
0  k < i, and we prove it for i.
By Theorem 5.23 we have
C(x

=
=

d)m

i 1
X

(i) =

i 1
X
k=0
iX
1
k=0

d)m

(( d)

(( 1)

(( d)

k=0

i k

i k+1 di

i k



i k


i k

d)m

C(x

m+k
k



i k

m+k
k

(k ) =

d)m

m+k
k

 dk for any

(k)) =

1  dk ) =

(5.37)

1):

At rst glan e to solve a de nite sum like in (5.37) one would use Zeilberger's
algorithm [Zei90, [Zei91. However it turns out that this problem is also solvable
by Gosper's algorithm [Gos78 for inde nite hypergeometri summation. Both
algorithms have been implemented in various pa kages for di erent omputer algebra systems [Car99, [PS95, and are des ribed in Se tion 1.3.1 and Se tion 1.3.2
as well as in [PWZ97, [Win96 and in [GvzG99, pages 622{639 and [GKP94,
pages 223{241. By using one of these pa kages, one obtains
( 1)

= k (



m+k
k
i k
i
k
i
1)  d k(m + k
im

i k+1 di

1 =

i)

 i k



m+k
k

1 ;

(5.38)

where k denotes the forward di eren e operator, i.e. k (f (k)) = f (k+1) f (k).
Therefore from (5.37) we get
(i) =

i k  di k (m + k i)  m m + k 1
(
1)
= k
=
 i k
k
i

m
k=0


m+i 1
 di;
=
i

C(x

d)m
iX
1

whi h, with (5.36), ompletes the proof.

(5.39)

5.8.

107

BINOMIAL CASE

Remark 5.8.1. The formula (5.25) allows us to generalize (5.35) to the ase
b(x) = (x d)m , for any positive integer . The orresponding formula be omes
(

 i=
d ;

if i  0 mod ;
(5.40)
( i ) = 0;
otherwise.
Remark 5.8.2. The binomial oe ient in the right hand side of (5.35):

 

m+i 1
m+i 1
= m 1 ;
i
also ounts all the ompositions of m + i into exa tly m parts. For a simple
bije tive proof of this see [And94, pages 54{57.
C(x

d)m

m+i=
i=

5.8.1 Diagrams of Compositions

In this se tion we de ne a relation between two integer ompositions and we prove


a property on su h relation that will be later useful to prove Corollary 5.8.1 in a
ombinatorial fashion.
De nition 5.8.1. For any non-negative integer i we de ne the relation !,
alled diagram relation, between two ompositions C1 ; C2 2 Comp(i) as follows:
C1 ! C2 if and only if C2 is obtained from C1 by merging two onse utive parts
of C1 into one.

We denote
by !
the transitive and re exive losure of the diagram relation.

Then C1 ! C2 means that C2 an be obtained from C1 by merging onse utive
parts of C1 into one.
For ea h omposition C we de ne the sign fun tion  as follows
(
1; if in C has an even number of even parts;
 (C ) =
(5.41)
1; otherwise.
Example 5.8.1.
For i = 4 we have:

[1,1,1,1

[2,1,1 [1,2,1 [1,1,2


[3,1 [2,2 [1,3
[4

108

CHAPTER 5.

For i = 5 we have:

COMBINATORIAL INTERPRETATION OF DIVISION

[1,1,1,1,1

[2,1,1,1 [1,2,1,1 [1,1,2,1 [1,1,1,2


[3,1,1 [2,2,1 [2,1,2 [1,2,2 [1,3,1 [1,1,3
[4,1

[3,2

[2,3

[1,4

[5
De nition 5.8.2.
with i parts:

For any non-negative i we denote by 1i the omposition of i


(5.42)
1i = [1|; 1;{z: : : ; 1}:
i

Lemma 5.8.2. For any positive integer i and any omposition C 2 Comp(i), the

number of ompositions D 2 Comp(i) with exa tly h parts, su h that D !
C is
given by


i k
;
(5.43)
h k
where k is the number of parts of C .

We prove this by using the bije tion between ompositions of i into


exa tly h parts and hoi es without repetitions of h 1 elements in f1; 2; : : : ; i 1g.
We an visualize ea h hosen element j as a line between j and j +1 in the range
[1; 2; : : : ; i.


The ondition D !
C means, by de nition of !
, that the omposition C
is obtained from D by merging some adja ent parts. In terms of hoi es in the set
f1; 2; : : : ; i 1g this means that the hoi es orresponding to the omposition C
must also orrespond to the omposition D.

Therefore the number of ompositions D with h parts, su h that D !
C
is given by the number of possible hoi es of h 1 (k 1) elements in a set
with i 1 (k 1) elements, sin e C has k parts to whi h k 1 hosen elements
orrespond. Thus we have that the nal ount is:

 

i k
i 1 (k 1)
(5.44)
= h k :
h 1 (k 1)

Proof.

5.8.

109

BINOMIAL CASE

Theorem 5.8.3. For any positive integer i and any omposition C of i we have
X
DjD !C

 (D) = C;1i :

(5.45)

We noti e that for any integer l su h that 1  l  i + 1, the number


of even parts in a omposition D 2 Comp(i) with i l + 1 parts, will be even if
l is even and odd otherwise. Therefore for the ompositions D 2 Comp(i) with
i l + 1 we have  (D) = ( 1)l+1 .
By Lemma 5.8.2, we have that
the number of ompositions D 2 Comp(i) with

i l + 1 parts, su h that D ! C , is given by
Proof.

i k
;
i l+1 k

(5.46)

where k is the number of parts of C .


Summing with the orresponding sign over all possible number of parts of D,
i.e. 1  l  i k + 1 we get
X
DjD !C

 (D ) =

iX
k+1
l=1

( 1)

l+1

i k
:
i l+1 k

(5.47)

The sum in (5.47), being a de nite hypergeometri sum, an be proved by


Zeilberger's algorithm, but it happens to be also solvable by Gosper's algorithm
for inde nite hypergeometri summation.
By performing one of these algorithms on (5.47) we get
iX
k+1
l=1

( 1)

l+1

i k
i l+1 k

= C;1i ;

(5.48)

whi h proves (5.45).



The sign fun tion  is a spe ial ase of the Mobius fun tion (see
[Str94b, pages 116{117) for partially
ordered sets, where the partial ordering

here is given by the relation !.
Remark 5.8.3.

5.8.2 Combinatorial Proof

Corollary 5.8.1 an also be proved in a purely ombinatorial way, namely by


nding a bije tion between two sets whose ardinality is given by the left hand
side and by the right hand side of (5.35), respe tively.

110

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

For any non-negative integer k, we all a set (respe tively multiset) with k
elements, a k-set (respe tively k-multiset). We all a sequen e with k elements
(respe tively without repetitions) a k-sequen e (respe tively a k-sequen e without
repetitions) .
De nition 5.8.3. For any non-negative integer k and any set S we de ne a
ombination (respe tively ombination without repetitions) from S of size k, to
be any k-subset (respe tively k-multiset) of S .
De nition 5.8.4. For any non-negative integer k and any set S we de ne a kpermutation (respe tively k-permutation without repetition) from S , to be any ksequen e of elements from S (respe tively k-sequen e of elements from S without

repetitions).

First of all we observe that the binomial oe ient in the right hand
side of (5.35):


m+i 1

Proof.

ounts all the ombinations with repetitions of size i from an m-set. For a simple
ombinatorial proof of this we refer to [Str94b, pages 13{17.
We show that the left hand side of the formula (5.35) des ribes an in lusionex lusion1 pro edure whi h ounts the ombinations with repetitions of size i from
an m-set by rst ounting all the i-permutations with repetitions and then by
subtra ting and adding i-permutations with repetitions where in reasingly larger
blo ks of onse utive elements are inversely ordered with respe t to a ertain
order.
Let us rst ount all the i-permutations with repetitions from an m-set. Sin e
for ea h position we have m hoi es, this over ounting yields:
 

 

 i

m



=
1 {z 1 } 1 ;

(5.49)

whi h in fa t orresponds to the omposition of i:


[1|; 1;{z   ; 1}:
i

In order to ount the i- ombinations with repetitions from an m-set, super uous i-permutations with repetitions must be removed.
1 For

a formal and very general de nition of in lusion-ex lusion see [Sta97, pages 64{67.

5.8.

111

BINOMIAL CASE

Let us onsider the m elements from whi h we have built all i-permutations
with repetitions totally ordered with respe t to .
We disregard those i-permutations in whi h in any position (i.e. from 1 to
i 1) two onse utive elements are not ordered2 with respe t to the relation .
This is done for all hoi es of 2 elements from m and for ea h position from
1 to i 1; therefore we subtra t from the ount:
 

   

  i

m m




=
2 | 1 {z 1 } 2 1
i

(5.50)

whi h orresponds to the ompositions of i:


[2; 1; 1;    ; 1; 1;
[1; 2; 1;    ; 1; 1;
:::::::::::::::::::::::
[1; 1; 1;    ; 1; 2:
By removing the super uous i-permutations where two onse utive elements
are not ordered with respe t to , we have also over ounted super uous ipermutations with repetitions where two onse utive elements are not ordered
with respe t to , in fa t ases with 3 onse utive elements in the opposite with
respe t to  and ases with two ouples of onse utive elements in the wrong
order are over ounted, for instan e ases with 3 onse utive elements inversely
ordered are removed both when the rst two onse utive elements and when the
se ond two onse utive elements are onsidered.
The over ounted i-permutations with repetitions orrespond to the next lass
of ompositions of i in whi h two parts are merged into one:
[3; 1; 1;    ; 1; 1;
[1; 3; 1;    ; 1; 1;
:::::::::::::::::::::::
[1; 1; 1;    ; 1; 3;
and
2 This

is how the sorting algorithm \bubble sort" works.

112

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

[2; 2; 1; 1    ; 1; 1;
[2; 1; 2; 1;    ; 1; 1;
:::::::::::::::::::::::::::
[2; 1; 1; 1;    ; 1; 2;
[1; 2; 2; 1;    ; 1; 1;
[1; 2; 1; 2;    ; 1; 1;
:::::::::::::::::::::::::::
[1; 2; 1; 1;    ; 1; 2;

:::::::::::::::::::::::::::
:::::::::::::::::::::::::::
In this way we have again over ounted those i-permutations with repetitions

where larger groups of onse utive elements are inversely ordered with respe t to
, whi h orrespond to ompositions of i with larger parts obtained by merging
two parts into one.
In the in lusion-ex lusion pro edure the sign of the orre tion will be positive
if the orresponding ompositions of i have an even number of even parts and
will be negative otherwise, in fa t merging two odd parts generates a new even
part and merging two parts where at least one is even de reases the number of
even parts by 1.
This pro ess an be des ribed as a diagram of i. Theorem 5.8.3 guarantees
that ea h lass of i-permutations with blo ks of onse utive elements inversely
ordered is ounted orre tly, i.e. the sum of the times in whi h it is in luded and
ex luded is zero.

Some related ombinatorial proofs on ompositions an be found in [And94,
pages 54{57 and [Str94b, pages 13{17.
Example 5.8.2.

Let us onsider all ombinations with repetitions of size 3 from the set fa; b; ; dg.
Then we are in the ase m = 4, and i = 3.
Counting all 3-permutations with repetitions from a 4-set, yields:
       3
4  4  4 = 4 = 64;
1
1 1 1
whi h orresponds to the omposition [1; 1; 1.
Let us des ribe 3-permutations with repetitions from a 4-set as strings3 of
size 3 from the set fa; b; ; dg where the onsidered ordering  is the alphabeti al
ordering.
3 Strings

are represented as sequen es of hara ters between round parentheses.

5.8.

BINOMIAL CASE

113

We disregard those 3-permutations with repetitions where two onse utive


elements are not in alphabeti al order. Therefore we are ounting those 3permutations with repetitions whi h mat h the following patterns4 :
(b a );
( b a);
( a );
( a);
(d a );
( d a);
(5.51)
( b );
( b);
(d b );
( d b);
(d );
( d ):
The number of all these ases is therefore
   
2  42  41 = 48;

where the patterns on the left and right olumn of (5.51) orrespond respe tively
to the ompositions [2; 1 and [1; 2.
By doing so we are over ounting 3-permutations with repetitions where 3
onse utive elements are not alphabeti ally ordered:
( b a);
(d b a);
(5.52)
(d a);
(d b):
The number of these ases is:
 
4 = 4;
3
whi h orresponds to the omposition [3.
In fa t the 3-permutations with repetitions in (5.52) mat h patterns both on
the left and on the right olumn of (5.51):
( b a) 2 ( b a) \ ( b );
(d b a) 2 ( b a) \ (d b );
(5.53)
(d a) 2 ( a) \ (d );
(d b) 2 ( b) \ (d ):
Hen e the nal ount is:
 
4 24  4 + 4 = 20 = 4 + 3 1:
(5.54)
3
3
2 1
1
4 In

this ontext a pattern is a set of strings represented with the same notation as of a string
but with at least one o urren e of the wild- ard hara ter \*", whi h denotes any possible
element of the set fa,b, ,dg.

114

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

5.9 Powers of Polynomials


We now onsider a well-known result5 that generalizes Corollary 5.8.1 to the
ase where b(x) is any rational power of a polynomial in R[x with onstant
oe ient in K n f0g. This result is a generalization of (5.35) but is obtained in
a totally di erent way, namely by seeing powers of polynomials as formal power
series (generating fun tions) whose oe ients an be des ribed by a re urren e.
We will refer to this method as exponentiation by generating fun tions. When
this method is used for dividing polynomials we will refer to it as dividing by
generating fun tions.
We introdu e the following notation:
d(x) 2 R[x; deg(d) = s; d0 2 K n f0g;
1
X
(5.55)
p
Gdp (i)xi ; Gdp (i) 2 R; 8i 2 N ;
dp (x) = d(x) =
i=0

where p 2 Q .
For brevity of notation we use (x) for dp (x) and G(i) for Gdp (i) whenever
this does not ause ambiguity.
Theorem 5.9.1. When d(0) = 1 and p is a non-negative integer, we have
(5.56)
Gdp (i) = Crevps (dp ) (i);
for any non-negative integer i.

By de nition, Gdp (i) is the oe ient of degree i in d(x) p, whi h is the


inverse of d(x)p. By Theorem 5.4.3 (5.15) Crevps(dp ) (i) is the oe ient of degree
i in the inverse of the revps(revps(dp)) = d(x)p .

Proof.

Theorem 5.9.2. For any non-negative integer i and any p 2 Q Gdp (i) is solution
of the following linear order re urren e of order s (degree of d(x)) with linear
oe ients:
s
X
i=0

(j + i  (p 1))diG(t

j) = 0

(8j 2 N n f0g):

(5.57)

First of all we noti e that using the de nition of (x) and di erentiating
we obtain
0 (x) = p  d(x) p 1  d0 (x):
Proof.

5 For

more details we refer to [GCL92, pages 114{116.

5.9.

115

POWERS OF POLYNOMIALS

This, together with the de nition of (x), yields a rst order linear di erential
equation:
d(x)  0 (x) + p  d0 (x)  (x) = 0:

Plugging the expli it forms of d(x) and (x) into this equation, yields
s
X
i=0

di

xi

1
X
i=0

G(i)

ixi

+p

s
X
i=0

ixi

di

1
X
i=0

(5.58)

G(i)xi = 0:

Computing the Cau hy produ t and shifting summation indi es gives


1
X

l
X

l=0

i=0
1
X

+p
=

l
X
i=0

l=0

1 X
l+1
X
l=0

+p
=

(i + 1)G(i + 1)dl

l
X
i=0

l=0

i=0

l=0

iG(i)dl

i=1
1
X

l+1
1 X
X

(G(i)(l
!
i+1

xl +

i + 1)dl

!
i+1

xl =

(5.59)

xl +

(G(i)(l

(i + (l

i + 1)dl

i + 1)p)dl

!
i+1

xl =

(i)

i+1 G

xl = 0:

Comparing the oe ients with respe t to x gives


l+1
X
i=0

(i + (l

We noti e that (dl

l+1
X

i + 1)p)dl

(i) = 0; 8l 2 N :

i+1 G

) has the nite support [l +1

i+1 i2N

(i + (l

i=l+1 s

i + 1)p)dl

s; l +1, and therefore

(i) = 0; 8l 2 N :

i+1 G

Substituting l + 1 by j and an index transformation give


s
X

i=0

(j + i  (p 1))diG(j i) = 0 8j 2 N n f0g:

(5.60)

116

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

5.9.1 Initial Values

From Property 5.3.1 (5.6) we have that the initial pvalue Gdp (0) must be the
inverse of the onstant oe ient of d(x)p, namely d0 . Moreover, the re urren e
(5.57) en odes the remaining s 1 initial values, whi h are obtained as the rst
s 1 solutions of (5.57) for t 2 [1; s 1:

5.10 The Algorithms


The re urren e (5.57) in Theorem 5.9.2 is an e ient algorithm for omputing
the modular inverse of powers of polynomials. Besides, fast inversion of powers
of polynomials by this method an be used to speed-up polynomial division by
powers of polynomials.
5.10.1 Modular Inverse

The re urren e (5.57) des ribes an algorithm that performs s multipli ations over
R at ea h step. In fa t from (5.57) we see that for t 2 N n f0g, we an write G(t)
as s summands:
s
(t + i  (p 1))  d  G(t i):
1 X
(5.61)
G(t) =
d0

i=1

Therefore the omplexity for the omputation of the inverse modulo xl by this
algorithm is O(s  l).
Exponentiation of dense univariate polynomials has been implemented in
C++. For more details and for a omparison with repeated squaring we refer to
the next hapter.
Remark 5.10.1. The omplexity of the previous algorithm is independent of the
power p.
Remark 5.10.2. For p = 1 the re urren e (5.61) be omes the re urren e (5.10)
used in the proof of Property 5.3.1.
5.10.2 Division by Powers of Polynomials
Division with remainder of the polynomial (x) 2 R[x of degree n by d(x)p,
where d(x) 2 R[x is a polynomial of degree s, an be done by rst omputing

the inverse of revps(d(x)p) modulo xn ps and then by multiplying the inverse of


revps(d(x)p) by revps( (x)).
Let us here denote by q(x) the quotient and by r(x) the remainder in the
division of (x) by d(x)p.

5.11.

SUMMARY

117

As seen in the proof of Theorem 5.4.3 in (5.22), we have


revps(d) p = revps(dp) 1 
(5.62)
 revn( ) 1  revn ps(q) mod xn ps+1;
from whi h it follows
revn ps(q)  revps(d) p  revn( ) mod xn ps+1:
(5.63)
Sin e deg(q) = n ps, the quotient an be omputed by (5.63) and by taking
the (p  s)-reversed.
Computing revps(d) p modulo xn ps+1 by (5.61) takes n ps steps, ea h
of whi h requires s multipli ations in the ground eld R. Therefore the overall
omplexity of the modular inversion is O(s(n ps)) = O(sn ps2), whi h, as
long as s is small, is linear in the degree of the quotient, i.e. n ps.
The omplexity of the omputation of the quotient will then depend on the
omplexity of the multipli ation of revps(d) p by revn( ), whi h dominates the
omplexity of the modular inversion.
The remainder is then omputed by the formula
r(x) = (x) d(x)p  q (x);
(5.64)
whi h has the omplexity of the multipli ation of d(x)p by q(x).
When omputing the remainder with (5.64), d(x)p an be omputed by the formula (5.61).
Division by powers of polynomial has been implemented in a C++ pa kage
for polynomial arithmeti . For more details and for the implementation in C++
we refer to the next hapter.
Remark 5.10.3.

5.11 Summary
In this hapter we have used the s hool division algorithm for polynomials to nd
a des ription of the modular inverse of a polynomial (Theorem 5.4.3). With this
result we an des ribe the oe ients of the modular inverse of a polynomial over
a eld ontaining Q by a linear re urren e (Theorem 5.5.1). Su h a linear re urren e has a ombinatorial meaning in terms of integer ompositions (Corollary
5.7.1).
We have treated the spe ial ase of the modular inverse of a binomial or
power of a binomial of a spe ial form (Corollary 5.8.1), whi h leads to prove the
ombinatorial identity (5.35), for whi h we an provide a ombinatorial proof
using the prin iple of in lusion-ex lusion.

118

CHAPTER 5.

COMBINATORIAL INTERPRETATION OF DIVISION

We have related these results to previous well-known fa ts whi h generalize


the re urren e orresponding to the spe ial binomial ase (Theorem 5.9.1).
In the end we des ribe how to use the re urren es as algorithms to ompute
powers of polynomials and how to divide polynomials by powers of polynomials.

Chapter 6
The

PolyComb

Pa kage

6.1 Introdu tion


We des ribe the algorithms and the stru ture of the C++/Mathemati a library
PolyComb for fast polynomial arithmeti . This hapter also ontains a manual
of the Mathemati a and C++ ommands provided by PolyComb. The library
has two parts: a C++ implementation of fast polynomial arithmeti for dense
and sparse polynomials, and a Mathemati a interfa e whi h makes it possible to
use the library from within the Mathemati a environment. The implemented
methods and operators between polynomials in lude addition, multipli ation,
exponentiation and division with remainder and various other auxiliary methods.
The C++ omponent of the library makes full use of the obje t oriented
paradigm and of generi programming through the extensive use of templates.
Thus polynomials over rings are de ned over any ring of oe ients that provide
the ne essary methods (operations) required by a ring.

6.2 Stru ture of the Library


The library has a Mathemati a [Wol99 omponent that provides an easy-to-use
interfa e, and a C++ omponent that implements fast polynomial arithmeti .
6.2.1 The Mathemati a Component

The part of the library written in Mathemati a [Wol99 is omposed by an interfa e and by a parser whi h is used by the interfa e to translate the polynomial
expression into a format whi h an be easily pro essed by the C++ library.
119

120

CHAPTER 6.

THE

POLYCOMB

PACKAGE

The Interfa e

Di erent versions of the interfa e are available depending on the type of polynomials involved in the expressions, e.g. whether the polynomials are sparse or
dense, whether their power produ ts are sparse or dense, whether their oe ients are arbitrary length integers or oating point reals, et . The interfa e
takes as input a polynomial expression in the Mathemati a syntax.
The interfa e invokes the parser, whi h, using also the information on the
type of polynomial expression, rewrites the expression in a spe ial ompressed
post x format (see next se tion for more details).
The interfa e uses the C++ library to perform the omputation and waits for
the result whi h is read in from the standard output devi e.
The Parser

The parser performs two tasks


1. It parses a polynomial expression, it mat hes the largest possible set of
subexpressions in it that an be onsidered a polynomial and writes them
as one polynomial. In this way it minimizes the size of the output and the
overhead time for ommuni ation (see Example 6.2.1).
2. It transforms the polynomial expression into a spe ial post x format that
an be read by the C++ omponent of the library.
Example 6.2.1.

The polynomial expression


3x2 + (4x3 + 2x)(x + 1) + x3 2
is parsed as
(x| 3 + 3{zx2 2}) + (4|x3{z+ 2x})( |x {z+ 1} )
polynomial

polynomial

polynomial

The post x form will be saved as a parenthesisless sequen e of polynomials


and operators. At the end of the pro ess the post x form is passed by the interfa e
to the library.
6.2.2 The C++ Component

The C++ omponent is the ore of the library whi h does all the omputation
and outputs the result into a le or s reen in a format that is both human readable
and that an be read and pro essed by Mathemati a.
The library pro esses the input in post x form by a sta k. It iteratively reads
an element in post x form and if it is a polynomial, it puts it into the sta k, if it

6.2.

121

STRUCTURE OF THE LIBRARY

is an n-ary operand, it takes n polynomials from the top of the sta k, it performs
the orresponding operation on them and puts the result into the sta k. The
nal result will be the polynomial left in the sta k.
6.2.3 The Communi ation

The following pi ture brie y des ribes how the omponents intera t with ea h
other.

Mathemati a
Interfa e
Polynomial Expression
Type of Polynomial

Parser

Polynomial Result

C++
Library

Post x Expression

The dotted arrow within the interfa e box means that the interfa e simply
alls the parser within its ode and uses its result.
The ommuni ation between the interfa e and the library is implemented by
saving the post x expression into a le whi h is then read by the C++ library.
The output is written in the standard output devi e. The interfa e reads the
output of the C++ library through the pipe me hanism.
This implementation is good when the library is alled only on e be ause
at ea h new all the library has to be restarted. When this is not the ase a
better me hanism should be used. For instan e the ommuni ation ould be
done through MathLink ([Wol99) or through a di erent me hanism in whi h
the library is always running in a stand-by mode as a server and whenever an
expression is sent to it by a lient (e.g. the Mathemati a interfa e), it \wakes
up" and pro esses the input.

122

CHAPTER 6.

THE

POLYCOMB

PACKAGE

6.3 Relations among Classes


The following diagram des ribes the relations among the lasses of polynomials
and power lasses present in the library.
Polynomal

Dense Polynomial

Sparse Polynomial

Power Produ t

Dense Power Produ t

Sparse Power Produ t

Sparse Univariate

Single Power

The lass of sparse polynomials implements sparse polynomials where the


lass of power produ ts to be used is a template parameter. The library provides
already three di erent lasses of power produ ts: sparse, dense and single power.
The lass of univariate sparse polynomials is derived form the lass of sparse
polynomials with single power as power produ t. It implements univariate sparse
polynomials and provides a few additional operations like Karatsuba multipli ation.
The lass of dense polynomials implements dense univariate polynomials with
Karatsuba multipli ation, s hool and Newton division, and exponentiation by
generating fun tions.

6.4 The Algorithms


Various algorithms for fast polynomial arithmeti that speed up produ t, exponentiation and division have been implement for sparse and dense polynomials.
6.4.1 Dense Polynomials

The implemented fast arithmeti for dense polynomials in ludes: Karatsuba multipli ation, division by Newton method, exponentiation by generating fun tions,
division by powers of polynomials by generating fun tions.

6.4.

THE ALGORITHMS

123

Karatsuba Multipli ation

Karatsuba algorithm is based on a divide-and- onquer strategy. For more details


we refer to [Win96, page 39 and [GvzG99, pages 210{215. Multiplying two
polynomials a(x) and b(x) an be done by splitting ea h polynomial into its
higher and lower part. For the sake of simpli ity let us onsider that both a(x)
and b(x) have degree n and that n is even.
Then we an write:
a(x) = a0 (x) + a1 (x)xn=2 ;
(6.1)
b(x) = b0 (x) + b1 (x)xn=2 ;
where a0, a1 , b0 and b1 have degree less than or equal to n=2.
Multiplying a(x) by b(x) yields:
a(x)  b(x) = (a0 (x) + a1 (x)xn=2 )  (b0 (x) + b1 (x)xn=2 ) =
(6.2)
= a1 (x)b1 (x)xn + a0(x)b0 (x) + (a1(x)b0 (x) + a0 (x)b1 (x))xn=2 :
We observe that
(a0(x) + a1 (x))  (b0 (x) + b1 (x)) =
(6.3)
a0 (x)b0 (x) + a0 (x)b1 (x) + a1 (x)b0 (x) + a1 (x)b1 (x):
Therefore
a0 (x)b1 (x) + a1 (x)b0 (x) =
(6.4)
(a0 (x) + a1 (x))  (b0 (x) + b1(x)) a0 (x)b0 (x) a1 (x)b1 (x):
So (6.4) allows us to simplify (6.2) as follows:
a(x)  b(x) =
a1 (x)b1 (x)xn + a0 (x)b0 (x)+
(6.5)
(a0 (x) + a1 (x))  (b0 (x) + b1(x)) a0 (x)b0 (x) a1 (x)b1 (x):
By applying (6.5) instead of (6.2) we perform only 3 multipli ations over
polynomials of degree n=2 instead of 4 multipli ations.
Computing a(x)  b(x) by applying re ursively (6.5) has omplexity O(nlog 3),
whereas the s hool algorithm has omplexity O(n2 )
2

Division by Newton Method

Division by Newton method (see [GvzG99, pages 243{249) is based on the idea
of dividing a(x) by b(x) by rst omputing the inverse of the reversed of b(x)
(see De nition 5.2.1) modulo an appropriate power of x through a symboli version of Newton iteration method, and then omputing the quotient by a fast
multipli ation algorithm (e.g. Karatsuba multipli ation).

124

CHAPTER 6.

THE

POLYCOMB

PACKAGE

When dividing a(x) by b(x) we want to nd q(x), r(x) su h that


a(x) = b(x)q (x) + r(x);

where deg r(x) < deg b(x) or r(x) = 0.


Let us also assume:

(6.6)

deg a(x) = n; deg b(x) = m:


Taking the n-reversed of a(x) (see De nition 5.2.1) yields
revn a(x) = revm b(x) revn m q(x) + revn r(x) =
(6.7)
= revm b(x) revn m q(x) + xn m+1 revm 1 r(x):
Thus we have the following ongruen e
revn a(x)  revm b(x) revn m q(x) mod xn m+1 ;
(6.8)
and also
revn m q(x) = revn a(x)(revm b(x)) 1 mod xn m+1 :
(6.9)
Therefore on e (revm b(x)) 1 is omputed, the quotient an be omputed by
the formula (6.9).
For the sake of simpli ity let us assume that b(0) = 1.
Computing b(x) 1 an be done by a symboli version of Newton iteration for
root nding. In this ase the fun tion to whi h we apply Newton iteration is:
(g) = 1=g f:
The general Newton iteration formula is:
(gi ) :
gi+1 = gi
0(gi)
whi h for (6.10) be omes:
gi+1 = gi

(6.10)
(6.11)

(1=gi f )( gi2) = 2gi fgi2:


(6.12)
The following theorem gives a good initial point for the iteration and tells us
that (6.12) qui kly onverges to the desired solution.
Theorem 6.4.1. Given a ommutative ring with unity R, f; g0 ; g1 ;    2 R[x,
with f (0) = 1, g0 = 1 and gi+1 = 2gi fgi2 for all i. Then
i
fgi  1 mod x2 for all i  0.
(6.13)

6.4.

125

THE ALGORITHMS

Let us pro eed by indu tion on i.


For i = 0 we have
fg0  f (0)g0  1 mod x2 :
(6.14)
Let us assume that (6.13) holds for a given positive integer j and prove it for
j + 1.
We see that
1 fgi+1  1 f (2gi fgi2)  1 2fgi + f 2gi2 
(6.15)
 (1 fgi)2  0 mod x2i :

Therefore gi onverges to the orre t solution in a logarithmi number of
steps. The overall omplexity of the Newton method for division is O(M (n)),
where M (n) is the omplexity of multiplying two polynomials of degree n. For
more details on the omplexity analysis we refer to [GvzG99, pages 243{263.
Proof.

+1

Exponentiation by Generating Fun tions

Exponentiating a polynomial by generating fun tions is done by onsidering the


power of polynomial as a formal power series (generating fun tion). Su h power
series satis es a ertain di erential equation (5.58) from whi h a re urren e (5.57)
satis ed by its oe ients an be obtained. For the details we refer to the previous
hapter and to [GCL92, pages 114-116.
Fast Division by Powers of Polynomials

When diving by possibly high powers of polynomials of low degree polynomials,


we an follow the same strategy as for division by Newton method, where the inversion is done by exponentiation through generating fun tions. For more details
we refer to the previous hapter and to [GCL92, pages 114-116.
Repeated Squaring for Fast Exponentiation

Exponentiation by repeated squaring (see [GvzG99, pages 69{70) of a polynomial


p(x) by a power n, with n 2 N is based on the simple re ursive formula:
8
>
<p

(x);
if n = 1;
n=
2
n=
2
(6.16)
p(x) = p(x)  p(x) ;
if n is even, n 6= 1;
>
:
(n 1)=2
(n 1)=2
p(x)
 p(x)
 p(x); if n is odd, n 6= 1:
This pro edure performs blog2 n squarings and H (n) 1  blog2 n multipli ations, where H (n) is the Hamming weight of the binary representation of n,
i.e. the number of 1s in it. For more details we refer to [GvzG99, pages 69{70.
n

126

CHAPTER 6.

THE

POLYCOMB

PACKAGE

6.4.2 Sparse Polynomials

Fast arithmeti for polynomials in sparse representation in ludes: Karatsuba multipli ation (it pays o if the involved sparsely represented polynomials are not
very sparse), multipli ation by geobu ke ts, repeated squaring for fast exponentiation.
Karatsuba Multipli ation

Karatsuba multipli ation an also be used for polynomials in sparse representation but its advantage over the s hool algorithm degrades qui kly when many
oe ients are zero. For more details we refer to Se tion 6.4.1 and also to [Win96,
page 39 and [GvzG99, pages 210{215.
Repeated Squaring for Fast Exponentiation

Repeated squaring for exponentiation of a polynomial is also implemented for


sparse polynomials. For more details we refer to Se tion 6.4.1 and also to
[GvzG99, pages 69{70.
Multipli ation by Geobu kets

Multipli ation of sparse possibly multivariate polynomials an be drasti ally sped


up by using the geobu ket data-stru ture to save intermediate sums. The original
paper where geobu kets were introdu ed is [Yan98.
The geobu ket data-stru ture speeds up the addition of many polynomials.
When multiplying two polynomials we have to sum up many polynomials to get
the result. Adding up many polynomials by simple insertion into an ordered list
representing the partial sum ends up almost always adding small polynomials to
a big partial sum. This has a bad worst ase omplexity orresponding to the
ase when the entire list ontaining the partial sum has to be visited to append
the terms of the new polynomial at the end.
The geobu ket data-stru ture avoids this problem by saving the partial sum
into a ve tor of lists of polynomials B where the i-th ell an only ontain 4i
monomials. Ea h ell is implemented as an ordered list of pairs ontaining a
power produ t and the orresponding oe ient. The addition of a polynomial
f to the geobu ket B is des ribed in Algorithm 6.1. A new polynomial f with
l monomials is added into the ell at position blog4 (l) , i.e. the lowest ell that
ould ontain the polynomial. If the maximum number of monomials in the ell
is ex eeded, we have an over ow, the ell is zeroed and its ontent is added to the
next ell until a ell is rea hed where the maximum number of allowed monomials
is not ex eeded.
We remark that the geobu ket does not represent a polynomial in a unique
way, and that monomials in di erent ells are not automati ally an eled.

6.5.

THE MATHEMATICA COMPONENT

127

Algorithm 6.1 Addition of a Single Polynomial to a Geobu ket


Input: A polynomial f .
Output: The polynomial f is added into B , i.e. B := B + f .
1: i := max(1; dlog4 (#f )e); // # means number of power produ ts
2: if i  m then
3:
f := f + B [i;
4:
while i  m and #f > 4i do
5:
f := f + B [i + 1;
6:
B [i := 0;
7:
i := i + 1;
8: m := max(m; i);
9: B [i := f:

By adding a polynomial to a geobu ket, we only add polynomials of similar


size and the maximum number of over ows for an addition is bounded by a
logarithm of the size of the polynomial.
In order to have the nal result the geobu ket needs to be anoni alized, i.e.
the ontent of all the ells must be added up.
Adding n polynomials f1 ; f2; : : : ; fn by a geobu ket su h that the total number
of monomials of f1 ; f2; : : : ; fn is N has omplexity O(Nlog(N )), whereas the
s hool algorithm has omplexity O(N 2 ).
Example 6.4.1.
The geobu ket B = [B [1; B [2; B [3 with
B [1 =

5x7 y + 13x5
(6.17)
B [2 = y 24 + 3x4 y 6 + 5x7 y + 17x5 + 2x2
B [3 = 4x5 + x2
has \internal an ellations" and represents y24 + 3x4y6 x2 + 4. In fa t the
\ anoni alization" gives
B [1 + B [2 + B [3 =
= ( 5x7 y 13x5) + (y24 + 3x4 y+5x7 y + 17x5 2x2 ) + ( 4x5 + x2 ) = (6.18)
= y24 + 3x4 y6 x2 :

6.5 The Mathemati a Component


The Mathemati a interfa e onsists of the following omponents:
 The Mathemati a pa kage pPostify.m,

128

CHAPTER 6.

THE

POLYCOMB

PACKAGE

 The Mathemati a notebook expand.nb,


 The exe utable program expand.out,
 The exe utable program power.out (only for dense polynomials).

These les are available on the world wide web at the ombinatori s home
page of RISC (University of Linz, Austria) at the following web address
http://www.ris .uni-linz.a .at/resear h/ ombinat/
6.5.1 Loading

In order to use the Mathemati a interfa e expand.out and pPostify.m must be


in the same dire tory as expand.nb.
To load the pa kage it is enough to load and evaluate the Mathemati a notebook expand.nb, whi h will also take are of loading the pa kage pPostify.m.
6.5.2 The Parser

The pa kage pPostify.m ontains the parser whi h provides the fun tions ne essary to onvert polynomial expressions into a spe ial post x format that an be
interpreted by the C++ library.
The pa kage exists in various versions that only di er by the kind of polynomials that are treated (dense univariate, sparse univariate, sparse multivariate)
and the type of power produ ts (sparse, dense).
The following types of polynomials are so far supported





dense univariate
sparse univariate
sparse multivariate with sparse power produ ts
sparse multivariate with dense power produ ts

Support for additional types of polynomials (e.g. dense multivariate, re ursively represented, et .) an be easily added without having to rewrite the
parser. It su es to rewrite the fun tion WritePoly of the parser ( ontained
in pPostify.m) that translates a polynomial in the Mathemati a syntax into
its internal representation (for more details see the se tion on the polynomial
representation).

6.5.

129

THE MATHEMATICA COMPONENT

The Post x Format

The ommand pPostify outputs a text le into a stream ([Wol99) ontaining a


sequen e of lines. Ea h line begins with a hara ter (meaning either a polynomial
or an operator) followed by some arguments, as in the following s heme:
Chara ter Meaning
X
P
T
E

polynomial identi er
sum
produ t
exponentiation

Arguments

polynomial representation
sum arity
produ t arity
exponent

Power Produ t Representation

The Mathemati a interfa e provides the following types of representations of


power produ ts:
 univariate (single power)
 dense
 sparse

Powers are simply represented by their exponent.


Sparse power produ ts are represented as a sequen e starting with the number
of powers followed by ouples (varId; power) where varId is an integer that
identi es an indeterminate and power is the orresponding power.
Dense power produ ts are represented as a sequen e of powers orresponding
to the powers of the indeterminates in the polynomial expression whi h is taken
into onsideration.
Example 6.5.1.

The power produ ts x5 y7z2 and x3 z6 are represented sparsely by the sequen es
3 |{z}
1 5 |{z}
2 7 |{z}
3 2;
x

respe tively, and densely by the sequen es


respe tively.

5 7 2;

2 |{z}
1 3 |{z}
3 6;
x3

3 0 6;

z6

130

CHAPTER 6.

THE

POLYCOMB

PACKAGE

Polynomial Representation

The following two kinds of polynomial representation are available:


 dense
 sparse
Dense polynomials are represented as a sequen e starting with an integer
indi ating the number of power produ ts followed by a sequen e of oe ients.
Sparse polynomials are represented as a sequen e beginning with an integer
indi ating the number of power produ ts and then by a sequen e of ouples
(pp; oef ) , where pp is the representation of a power produ t and oef is the
orresponding oe ient.
Example 6.5.2. A univariate polynomial
The polynomial 3x5 + 7x2 + 2x + 1 is sparsely represented by the sequen e
4 |{z}
0 1 |{z}
1 2 |{z}
2 7 |{z}
53
1

2x

7x2

3x5

and it is densely represented by the sequen e


6127003
Example 6.5.3. A multivariate sparse polynomial
The polynomial 3xz + 5y2 + 1 is represented as a sparse multivariate polynomial
with sparsely represented power produ ts by the sequen e
3 |{z}
0 1 |1 2{z2 5} |2 1 1{z3 1 3}
3xz

5y2

and it is represented as a sparse multivariate polynomial with densely represented


power produ ts by the sequen e
3 |0 0{z0 1} |0 2{z0 5} |1 0{z1 3}
1

The Post x Translator Command

5y2

3xz

The ommand pPostify is ontained in the Mathemati a pa kage pPostify.m.


Command

pPostify[strm, expr

6.5.

THE MATHEMATICA COMPONENT

131

Parameters




strm is the stream where we want pPostify to write its output. It an also
be "stdout" whi h is the standard output, i.e. the Mathemati a window.
expr is

, ^ .

a Mathemati a polynomial expression ontaining the operators +,

Semanti s

transforms a polynomial into the post x format that an be interpreted by the C++ library. Its output depends on the kind of polynomials that
are treated.
The type of polynomial is given by loading the orresponding routines. This
is so far implemented1 by having more versions of the pa kage pPostify.m.
pPostify

Example 6.5.4. A univariate polynomial


The expression (3x5 + 2x3 + 4x + 7)(x3 + 2) + 5x + 2 is onverted by pPostify
in the following way:
pPostify["stdout", (3x^5 + 2x^3 + 4x + 7)(x^3 + 2) + 5x + 2

(sparse version)
Output =
X 2
X 2
X 4
T 2
P 2

0 2
0 2
0 7

1 5
3 1
1 4

3 2

5 3

(dense version)
Output =
X
X
X
T
P

2 2 5
4 2 0 0 1
6 7 4 0 2 0 3
2
2

A multivariate sparse polynomial


The polynomial expression (3xz + 5y2 + 1)(2y + x) + 7x is onverted into post x
form by pPostify as follows

Example 6.5.5.
1 This

ould also be done with a uni ed pa kage and by passing the type of polynomials and
the type of power produ ts through an option or parameter to the ommand pPostify.

132

CHAPTER 6.

THE

POLYCOMB

PACKAGE

pPostify["stdout", (3 x z + 5 y^2 + 1)(2y + x) + 7x

(sparsely represented power produ ts)


Output =
X 1
X 2
X 3
T 2
P 2

1 1 1 7
1 1 1 1 1 2 1 2
0 1 1 2 2 5 2 1 1 3 1

(densely represented power produ ts)


Output =
X 1
X 2
X 3
T 2
P 2

1 0 0 7
1 0 0 1 0 1 0
0 0 1 0 2 0 5

2
1 0 1

6.5.3 The Mathemati a Commands

The Mathemati a ommands use the library to perform expansion of polynomial


expressions and exponentiation of polynomials.

The Polynomial Expansion Command

The ommand PolynomialExpand is ontained in expand.nb. It also requires


the les pPostify.m and expand.out.
Command

PolynomialExpand[expr

Parameter
expr is a Mathemati a polynomial expression

tors +,  , ^ .

Options

Name

Algorithm
Verbose

Semanti s

possibly ontaining the opera-

Default Value
expand.out

PolynomialExpand[expr fully expands the polynomial expression expr by


using pPostify and expand.out. It rst invokes pPostify to transform the ex-

pression into the post x format. Then it uses the C++ library by the exe utable

6.5.

133

THE MATHEMATICA COMPONENT

expand.out to expand the expression. The


PolynomialExpand from a temporary le.

output from expand.out is read by

Meaning of the options

is the name of the exe utable le that uses the C++ library
to perform the polynomial expansion. Di erent versions of the exe utable,
using for instan e di erent oe ient rings, an exist.
 Verbose toggles the verbosity level.


Algorithm

Example 6.5.6.

The expression ((x + 1)10 + (y 1)3) + x5z3 (x3 1) an be expanded by the


ommand PolynomialExpand as follows
PolynomialExpand[((x + 1)^10 + (y - 1)^3) + x^5 z^3 (x^3 - 1)

Output =

10x1 + 45x2 + 120x3 + 210x4 + 252x5 x5z3 + 210x6


+ 120x7 + 45x8 + x8 z3 + 10x9 + x10 + 3y1 3y2 + y3

(6.19)

The Exponentiation Command

The polynomial ommand ModPower is ontained in the le power.nb. It also


requires the les pPostify.m and power.out.
Command

ModPower[poly, power, thr

Parameter





poly is a polynomial (in the Mathemati a syntax).

power is the power to whi h we want to exponentiate poly.

is the exponent of the modulo xthr with respe t to whi h we ompute


the power (x is the indeterminate).

thr

Options

Name

Algorithm
Verbose

Default Value
power.out

134

CHAPTER 6.

THE

POLYCOMB

PACKAGE

Semanti s

omputes
poly power mod xthr ;
(6.20)
by alling power.out whi h reads the polynomial through a le. ModPower uses
the ommand WritePoly ( ontained in pPostify.m) to translate poly into its
internal representation. The so far implemented version assumes that poly has
onstant oe ient equal to one. The output is then read by ModPower through
the pipe me hanism.
ModPower[poly,power,thr

Meaning of the options


Algorithm is the name of the exe utable le that uses the C++ library
to perform the polynomial exponentiation. Di erent versions of the exe utable, using for instan e di erent oe ient rings, an exist.
 Verbose toggles the verbosity level.

Example 6.5.7.

We an ompute the modular inverse of (x +1) modulo x10 by ModPower as follows


ModPower[(x + 1), -1, 10

Output =

x + x2

x3 + x4

x5 + x6

x7 + x8

x9

(6.21)

Example 6.5.8.

We an ompute (2x3 3x + 1)12 modulo x8 by ModPower as follows


ModPower[(2x^3 - 3x + 1), 12, 8

Output =
1 36x + 594x2 5916x3 + 39303x4 180576x5 + 566940x6 1098504x7 (6.22)

6.6 The C++ Library


The C++ library for polynomial arithmeti onsists of the following parts:
 dense polynomial library
 sparse polynomial library
The C++ libraries are available on the world wide web at the ombinatori s
home page of RISC (University of Linz, Austria) at the following web address
http://www.ris .uni-linz.a .at/resear h/ ombinat/

6.6.

THE C++ LIBRARY

135

6.6.1 Sparse Polynomial Library

The sparse polynomial library is ontained in the following les (followed by the
extensions .h and . xx):
File name
Des ription
log4
logarithm base four
lassLong
lass for long integers
uniPowers
lass of powers
powerProdu ts
lass of sparse power produ ts
densePowerProdu ts lass of dense power produ ts
polynomialRing
sparse polynomial ring lass
uniPolynomials
univariate sparse polynomial ring lass
The additional le expand. xx is required to generate expand.out, whi h is
required by the Mathemati a interfa e (expand.nb).
The Power Produ ts Classes

The implemented power produ ts types are ontained in the following template
lasses
Template Parameters
Type of power produ t File
uniPowers
single powers
expType
powerProdu ts
sparse power produ ts varType, expType
densePowerProdu ts
dense power produ ts nVars, expType
whose parameters are
Parameter Type of parameter Des ription
expType
lass
Type of the exponents of the powers
varType
lass
Type des ribing the indeterminates
nVars
int
Number of variables
A power produ t implementation in order to be used as a parameter of
polynomialRing must provide a onstru tor with no arguments, the overloaded
operators for produ t, produ t \in pla e", omparison, input, output and the
method one() to ompute the unit power produ t.
The Coe ients

The oe ient ring is not implemented in the library but has to be provided as
a parameter to the polynomial template lasses.
A oe ient ring implementation must at least provide a onstru tor with no
arguments, all the overloaded operators for sum, sum \in pla e", di eren e, pre x

136

CHAPTER 6.

THE

POLYCOMB

PACKAGE

and post x in rement, pre x and post x de rement, produ t, produ t in \pla e",
omparison, assignment input, output and the method zero() to ompute the
zero element.
The template lass lassLong (in lassLong.h and lassLong. xx) adds
the method zero() to the C++ prede ned types (int, float, double, et .) and
to the GMP lasses ([GNU) mpz lass and mpr lass.
The library has so far been tested with the following built-in oe ient rings:
 int
 long long
 float
 double
 long double
and with the following additional implementations of oe ient rings:
 mpz lass (GMP2 implementation of arbitrary length integers)
 mpr lass (gmp implementation of rationals)
 NTL::ZZ (NTL3 implementation of arbitrary length integers)
 user de ned template lass for Zp, with p prime
The polynomialRing Class

Sparse polynomials are implemented in the template lass polynomialRing whi h


take the following parameters
Parameter Des ription
ppType
Power Produ t Class
oeRing
Coe ient Ring Class
The lass polynomialRing implements
 binary operators between polynomials for sum and produ t,
 unary operators + =,  = for \in pla e" sum and produ t,
 the exponentiation operator ^ ,
 the method
2 For

3 For

an on line do umentation we refer to [GNU.


an on line do umentation we refer to [Sho.

6.6.

THE C++ LIBRARY

137

void
gbMult(polynomialRing<ppType, oeRing> & poly)

whi h multiplies the polynomial \in pla e" by poly using a geobu ket,
 the method
void
expandFromFile(istream & sor)

whi h expands \in pla e" a polynomial expression from the stream sor,
 the operators <<, >> for input and output from and to streams.
A text le with name varNames has to be present in the same dire tory
as expand.out. Su h le must ontain an integer representing the maximum
number of indeterminates followed by the names of the indeterminates used for
the output format. When the library is used through the Mathemati a interfa e
the appropriate le varNames is generated automati ally.
The uniPolynomial Class

Sparse univariate polynomials are implemented in uniPolynomial, whi h is a


derived lass of polynomialRing, namely in the C++ syntax:
template< lass degType, lass oeRing>
lass uniPolynomial :
publi polynomialRing<uniPower<degType>, oeRing>;

The lass uniPolynomial takes the following parameters


Parameter Des ription
degType
Type representing the exponents
oeRing
Class of the oe ient ring
It inherits all the methods of polynomialRing and implements
 the friend fun tion
uniPolynomial<degType, oeRing>
Karatsuba( onst uniPolynomial<degType, oeRing> & lhs,
onst uniPolynomial<degType, oeRing> & rhs)

whi h multiplies two polynomials by Karatsuba's algorithm,


 the method

138

CHAPTER 6.

THE

POLYCOMB

PACKAGE

uniPolynomial<degType, oeRing>
shift( onst degType d)

whi h multiplies a polynomial in x by the power xd ,


 the method
uniPolynomial<degType, oeRing>
modulo( onst degType m)

whi h omputes a polynomial in x modulo xm ,


 the method
uniPolynomial<degType, oeRing>
reversed( onst degType d)

whi h omputes the d-reversed polynomial.


A text le with name varName has to be present in the same dire tory as
expand.out. Su h le must ontain the name of the indeterminate used for the
output format. When the library is used through the Mathemati a interfa e the
appropriate le varName is generated automati ally
6.6.2 Dense Polynomial Library

The dense polynomial library is implemented in uniPolynomial that is a template lass ontained in the following les (followed by the extensions .h and
. xx):
File name
Des ription
log2
logarithm in base two
lassLong
lass for long integers
uniPolynomials lass of univariate dense polynomials
The exe utables expand.out and power.out that are used with the Mathemati a interfa e are produ ed by the les
File name Des ription
expand. xx expand input from Mathemati a
power. xx exponentiates input from Mathemati a
The dense polynomial lass implements
 binary operators between polynomials for sum and produ t;

6.6.

THE C++ LIBRARY

 unary operators + =,  = for \in pla e" sum and produ t;


 the exponentiation operator ^ ;
 the friend fun tion
uniPolynomial< oeRing>
Karatsuba( onst uniPolynomial< oeRing> & lhs,
onst uniPolynomial< oeRing> & rhs)

whi h performs multipli ation by Karatsuba algorithm;


 the method
pair<uniPolynomial< oeRing>,uniPolynomial< oeRing> >
divide( onst uniPolynomial< oeRing> & lhs,
onst uniPolynomial< oeRing> & rhs)

whi h performs division by the s hool algorithm;


 the method
pair<uniPolynomial< oeRing>,uniPolynomial< oeRing> >
Newton( onst uniPolynomial< oeRing> & lhs,
onst uniPolynomial< oeRing> & rhs)

whi h divides lhs by rhs using Newton division;


 the method
pair<uniPolynomial< oeRing>,uniPolynomial< oeRing> >
GFdivide( onst uniPolynomial< oeRing> & lhs,
onst uniPolynomial< oeRing> & rhs,
onst long p)

whi h divides lhs by rhsp by generating fun tion driven division;


 the method
void
modPower( onst uniPolynomial< oeRing> & base,
onst long p,
onst long m)

whi h omputes the p-th power of base modulo xm .

139

140

CHAPTER 6.

THE

POLYCOMB

PACKAGE

 the method
void
expandFromFile( istream & sor)

expands \in pla e" a polynomial expression from the stream sor;
 the operators <<, >> for input and output from and to streams.

6.7 A Small Program


The following program reads two sparsely represented polynomials with sparsely
represented power produ ts from the les polyA.pol and polyB.pol, prints on
the s reen the two polynomials, their sum, their produ t ( omputed by the s hool
algorithm), their squares, then it omputes the produ t by geobu ket multipli ation, it stores it into the rst polynomial and prints the result.
The oe ient ring oeR is provided by the template lass mpz lass of the
GMP library [GNU for arbitrary length integers and rationals (by in luding
gmp.h and gmpxx.h). In order to make mpz lass a suitable parameter for
polynomialRing it is wrapped in the template lass lassLong whi h gives the
extra methods required by the template parameter of polynomialRing.
#in lude
#in lude
#in lude
#in lude
#in lude
#in lude

<gmp.h>
<gmpxx.h>
<iostream>
<fstream>
" lassLong.h"
"polynomialRing.h"

typedef lassLong<mpz_ lass> oeR;


typedef long degType;
typedef short varType;
void main()
{
polynomialRing<powerProdu t<varType, lassLong<degType> >, oeR> a;
polynomialRing<powerProdu t<varType, lassLong<degType> >, oeR> b;
ifstream r1Stream("polyA.pol");
r1Stream >> a;
r1Stream. lose();
ifstream r2Stream("polyB.pol");
r2Stream >> b;

6.8.

141

BENCHMARKS

r2Stream. lose();
out << "a : " << a << endl;
out << "b : " << b << endl;
out << "a + b = " << a+b << endl;
out << "a * b = " << a * b << endl;
out << "a^2 = " << (a^2) << endl;
out << "b^2 = " << (b^2) << endl;
a.gbMult(b);
out << "(using Geobu kets) a := a * b" << endl;
out << "a
= " << a << endl;
};

When polyA.pol ontains


2

1 1 1

2 1 1

whi h represents x1 + y1, and polyB.pol ontains


2

2 2 1

1 1 3 1

whi h represents y2 + x1 z1 , the program will output


a : (1)x^1 +(1)y^1
b : (1)y^2 +(1)x^1 z^1
a + b = (1)x^1 +(1)y^1 +(1)y^2 +(1)x^1 z^1
a * b = (1)x^1 y^2 +(1)y^3 +(1)x^2 z^1 +(1)x^1 y^1 z^1
a^2 = (1)x^2 +(2)x^1 y^1 +(1)y^2
b^2 = (1)y^4 +(2)x^1 y^2 z^1 +(1)x^2 z^2
(using Geobu kets) a := a * b
a
= (1)x^1 y^2 +(1)y^3 +(1)x^2 z^1 +(1)x^1 y^1 z^1

6.8 Ben hmarks


Here we present some ben hmarks that ompare the performan e of the Mathemati a built-fun tions for polynomial expansion and polynomial exponentiation
with PolyComb (the C++ library run through the Mathemati a interfa es) for
polynomial expansion (to be found in the le expand.nb) and the for polynomial
exponentiation (to be found in the le power.nb).

142

CHAPTER 6.

THE

POLYCOMB

PACKAGE

6.8.1 Measurements

We present some timings of the Mathemati a built-in fun tions versus our library
used through its Mathemati a interfa e for polynomial expansion.
These timings measure the overall time spent by the library when used through
the Mathemati a interfa e. The overhead produ ed by the parsing of the expressions and by the data inter hange is also in luded in the timings.
The oe ient arithmeti is provided by the lass mpz lass of the GMP
library [GNU for arbitrary length arithmeti .
Modality of Measurement

All the tests have been run on a Pentium IV 1,5 Megahertz equipped with 512
Megabytes of memory and under the Linux operating system. For the Mathemati a ode of the tests we refer to Appendix B. The timings are measured only
in se onds and are not to be onsidered very a urate sin e slight variations exist
in di erent exe utions of the tests.
6.8.2 Polynomial Multipli ation and Expansion
Dense Polynomials

Here we present some timings of the Mathemati a built-in fun tions versus our
library used through the Mathemati a interfa e for polynomial expansion using
Karatsuba multipli ation and using s hool multipli ation.
degree Mathemati a Karatsuba Mult. S hool Mult.
1000
10
1
1
2000
43
3
4
3000
97
5
7
4000
167
6
12
For more details see Appendix B.
Sparse Univariate Polynomials

Here we present some timings of the Mathemati a built-in fun tions ompared
with the timings of our library when used through its Mathemati a interfa e for
polynomial expansion using geobu ket multipli ation and using s hool multipli ation.
The test measures in se onds the time spent for omputing the produ t
of two univariate polynomials with exa tly t = m  100 monomials, for m =
2; 3; 4; 5; 6; 7; 8; 9.

6.8.

BENCHMARKS

143

Ea h oe ient is in the range between 0 and 9 and has degree in the range
between 1 and m  107. We refer to the Appendix B for more details on how the
tests were exe uted.
power produ ts Mathemati a Geobu ktes S hool Algorithm
200
2
2
1
300
7
3
4
400
17
5
7
500
33
8
12
600
56
12
19
700
88
17
28
800
133
22
39
900
192
29
54
1000
264
35
72
For more details see Appendix B.
Sparse Multivariate Polynomials

Here we present some timings of the Mathemati a built-in fun tions versus the
polynomial library used through the Mathemati a interfa e for polynomial expansion in a version using both geobu ket multipli ation and in a version using
s hool multipli ation.
The test measures in se onds the time spent for expanding an expression of the
form p1  p2 +( p1 +1)  p2 where p1 and p2 are randomly generated polynomial in
m = 4; 8 indeterminates with exa tly t = 300; 400; 500; 600; 700 power produ ts.
Ea h oe ient is in the range between 0 and 9 and ea h power produ t is a
produ t of the m indeterminates whose exponent has a 90% probability of being
0 and a 10% probability of being a value in the range between 1 and 99. We refer
to the Appendix B for more details on how the tests were exe uted.
Case m = 4
power produ ts Mathemati a Geobu ktes S hool Algorithm
300
23.5
4.0
6.0
400
54.0
7.5
14.0
500
102.5
11.5
26.5
600
177.0
19.0
46.0
700
275.0
27.0
72.5
800
438.0
36.0
113.0
900
587.0
51.0
166.0
1000
636.0
62.0
232.0

144

CHAPTER 6.

THE

POLYCOMB

PACKAGE

Case m = 8

power produ ts Mathemati a Geobu kets S hool Algorithm


300
27.0
4.5
7.5
400
62.5
9.0
16.0
500
119.5
13.5
31.0
600
200.5
21.0
57.0
700
327.5
27.5
91.5
800
348.0
38.0
140.0
900
506.0
47.0
204.5
1000
707.0
61.0
335.0
For more details see Appendix B.

6.8.3 Polynomial Exponentiation

Here we present some timings of the Mathemati a built-in fun tions versus the
Mathemati a interfa e for polynomial exponentiation using the generating fun tion method and repeated squaring.
The tests measure in se onds the time spent for exponentiating to the power
p = 50; 100; 150; 200; 250 randomly generated dense polynomials with degree d =
10; 20; 40 and oe ients in the range f0; 99g by
 Built-in Mathemati a Expand ommand
 Mathemati a interfa e using exponentiation by generating fun tions
 Mathemati a interfa e using repeated squaring
Case d = 10

p (power) Mathemati a Generating Fun tions Repeated Squaring


50
1
<1
<1
100
6
<1
1
150
15
1
3
200
27
1
6
250
44
2
13
Case d = 20
p (power) Mathemati a Generating Fun tions Repeated Squaring
50
5
<1
1
100
23
1
3
150
54
1
11
200
106
2
28
250
212
4
58

6.9.

CONCLUSION

145

Case d = 40

p (power) Mathemati a Generating Fun tions Repeated Squaring


50
22
<1
2
100
92
1
13
150
214
3
46
200
382
5
109
250
781
8
238
For more details we refer to Appendix B.

6.9 Con lusion


The library so far provides only basi arithmeti operations for polynomials in
distributed representation. The next step ould be to extend the library into two
dire tions:
 providing dire t support for polynomials in re ursive representation
 implementing more operations
 improving e ien y of the overloaded operators
The library allows having polynomials as oe ients of polynomials but no
operations tailored for su h representation, like onversions between di erent
representations, have been implemented, yet.
The library ould also be extended with more operations like multivariate
greatest ommon divisor.
Overloaded operators su h as + and * are so far implemented in a straightforward way and do not delay evaluation to improve e ien y. For instan e, the
ommand:
a=b+
(6.23)
would ompute the sum of b and and write the result in a temporary lo ation
and then it would opy it into a.
Delaying the addition until an assignment operator is being evaluated would
solve the problem. This an be done by having the operators output an unevaluated result in a spe ial data stru ture. The assignment would then perform the
operation (or operations).

146

CHAPTER 6.

THE

POLYCOMB

PACKAGE

Appendix A

Chinese Remainder Problem


The Chinese remainder algorithm solves a system of ongruen es of the form
x  r1 mod m1
:::
(6.24)
x  rt mod mt
where the ri and mi, for 1  i  t, are elements of a ring and the mi are pairwise
relatively prime.
We refer to the ri as remainders and to the mi as moduli.

Lagrange Interpolation
Lagrange Interpolation is based on the Lagrange interpolating polynomial, i.e.
the polynomial P (x) 2 F [x, with F eld, of degree n 1 whi h passes through
the points
y1 = P (x1 );

(6.25)
yn = P (xn );
whi h is given by
n
X
P (x) =
Pj (x);
(6.26)
j =1

with

Pj (x) =

n
Y
k=1
k6=j

x xk
y:
xj xk j

147

(6.27)

148

Appendix A

Newton Interpolation
Newton Interpolation uses the Chinese remainder algorithm to interpolate a polynomial where the onsidered ring is the ring of polynomials over a eld. We onsider the Chinese remainder problem where the remainders ri = f (pi) are values
of the unknown fun tion f at pi and the moduli are linear fun tions of the form
x pi , where x is the indeterminate:
x  r1 (x p1 )
:::
(6.28)
x  rt (x pt )
Remark: Newton interpolation is superior to Lagrange interpolation in that
it an be used in an in remental fashion.

Appendix B

Here we give some details on how the timings of the library for polynomial arithmeti were obtained.

Multipli ation of Dense Univariate Polynomials


For testing multipli ation between two dense univariate polynomials we have used
the following Mathemati a ode:
rC := Random[Integer,{0,10^10-1}
rP[deg_ := Sum[rC x^i,{i,0,deg}
p1 = rP[...;
p2 = rP[...;
initT = AbsoluteTime[;
r2 = PolynomialExpand[p1 p2;
Print["[",
Max[N[AbsoluteTime[-initT-1,1,0,",",
N[AbsoluteTime[-initT+1,1,"";
initT = AbsoluteTime[;
r1 = Expand[p1 p2;
Print["[",
Max[N[AbsoluteTime[-initT-1,1,0,",",
N[AbsoluteTime[-initT+1,1,"";

Ea h oe ient is in the integer range [0; 1010 1.

Multipli ation of Sparse Univariate Polynomials


For testing multipli ation between two sparse univariate polynomials we have
used:
r :=Random[Integer,{1,10-1};
dr[i_:=Random[Integer,{1,i};
rP[range_,size_ := Module[{res},
res = 0;
While[Length[res != size,
res = res + r y^dr[range
;
Return[res

149

150

Appendix B

;
m = ...;
p1 = rP[m * 10^7,m * 100;
p2 = rP[m * 10^7,m * 100;
initT = AbsoluteTime[;
r1 = Expand[p1 p2;
Print[AbsoluteTime[-initT
initT = AbsoluteTime[;
r2 = PolynomialExpand[p1 p2;
Print[AbsoluteTime[-initT

Ea h oe ient is in the range between 0 and 9 and has degree in the range
between 1 and m  107.

Expansion of Sparse Multivariate Polynomials


We have tested multipli ation and addition with the following Mathemati a ode:
sparsity=9;
r :=Random[Integer,{1,10-1};
dr[i_:=If[Random[Integer,{0,9}<sparsity,
0,
Random[Integer,{1,10^5-1};
var[i_:=ToExpression[StringJoin["x",ToString[i;
rT[nVars_:=Produ t[var[i^dr[i,{i,1,nVars};
rP[nVars_,size_ := Module[{res},
res = 0;
While[Length[res != size,
temp =r rT[nVars;
If[ !IntegerQ[temp,
res = res + temp;
;
;
Return[res
;
m = ...;
p1 = rP[m,...;
p2 = rP[m,...;
p3 = (-p1+1);p4 = p2;
initT = AbsoluteTime[;
r1 = Expand[p1 p2+p3 p4;
Print["[",Max[N[AbsoluteTime[-initT-1,1,0,",",
N[AbsoluteTime[-initT+1,1,"";
initT = AbsoluteTime[;
r2 = PolynomialExpand[p1 p2 + p3 p4;
Print["[",Max[N[AbsoluteTime[-initT-1,1,0,",",
N[AbsoluteTime[-initT+1,1,"";

Ea h oe ient is in the integer range between 0 and 9 and ea h power produ t


is a produ t of the m indeterminates whose exponent has 90% probability of being
0 and 10% probability of being a value in the integer range between 1 and 99.
This test was run twi e and the average timings were onsidered.

Appendix B

151

We noti e that in rementing the number of variables nVars does not


always make the problem of multiplying two polynomials generated by rP[nVars,
size harder.
Note:

Exponentiation of Dense Univariate Polynomials

For testing exponentiation we have used:


rC := Random[Integer,{0,10^2-1}
rP[deg_ := Sum[rC x^i,{i,0,deg}
deg = ...;
pAUX = rP[pDeg;
p = pAUX - Coeffi ient[pAUX,x,0+1;
modulo = exponent*Exponent[p,x+1;
initT = AbsoluteTime[;
res = ModPower[p,exponent,modulo;
AbsoluteTime[-initT
initT = AbsoluteTime[;
res2 = Expand[p^exponent;
AbsoluteTime[-initT

In this test ea h oe ient is in the integer range [0; 99.

152

Appendix B

Curri ulum Vitae

Personal Data

First Name:
Family Name:
Birthday:
Address:

Fabrizio
Caruso
19/09/1972
Via Del Popolo, 45/a,
95040, Li odia Eubea (CT), Italy
Studies

1986{1991

High S hool

(\Maturita s ienti a"),


Li eo S ienti o, Caltagirone, Italy
1991{1996 Master Degree in Computer S ien e
(\Laurea in Informati a"),
University of Catania, Italy
1997{
PhD Studies in Symboli Computation
RISC, Johannes Kepler University, Linz, Austria
Grants

 SFB grant F1305 of the Austrian FWF


 Grant from the University of Catania for spe ialization in a foreign in-

stitution (\Borsa di studio per orsi di perfezionamento presso istituzioni


estere")
 Grant no. 203.15.10 from the CNR (Italian national resear h oun il)

154

Bibliography

[Abr95 S.A. Abramov. Rational solutions of linear di erential and di eren e


equations with polynomial oe ients. In Pro . ISSAC '95. ACM Press,
1995.
[And94 G.E. Andrews. The Theory of Partitions. Cambridge University Press,
1994.
[APa S.A. Abramov and M. Petkovsek. Minimal de omposition of inde nite
hypergeometri sums. ( orre ted) preprint.
[APb S.A. Abramov and M. Petkovsek. On the stru ture of multivariate hypergeometri terms. preprint.
[AP99 G.E. Andrews and P. Paule. Ma Mahon's Partition Analysis IV: Hypergeometri multisums. Sem. Lothar. Combin., (B42i):1{24, 1999.
[APR01a G.E. Andrews, P. Paule, and A. Riese. Ma Mahon's Partition Analysis
III:The Omega Pa kage. European J. Combin., (22):887{904, 2001.
[APR01b G.E. Andrews, P. Paule, and A. Riese. Ma Mahon's Partition Analysis
IX: k-gon partitions. Bull. Austral. Math. So ., (64):321{329, 2001.
[APR01 G.E. Andrews, P. Paule, and A. Riese. Ma Mahon's Partition Analysis
VI: A new redu tion algorithm. Ann. Comb., (5):251{270, 2001.
[APR01d G.E. Andrews, P. Paule, and A. Riese. Ma Mahon's Partition Analysis VII: Constrained ompositions. In B.C. Berndt and K. Ono, editors, q-Series with Appli ations to Combinatori s, Number Theory, and
Physi s, volume 291 of Contemp. Math., pages 11{27. Amer. Math. So .,
2001.
[APR01e G.E. Andrews, P. Paule, and A. Riese. Ma Mahon's Partition Analysis
VIII: Plane partition diamonds. Adv. in Appl. Math., (27):231{242,
2001.
155

156

BIBLIOGRAPHY

[APRS G.E. Andrews, P. Paule, A. Riese, and V. Strehl. Ma Mahon's Partition Analysis V: Bije tions, re ursions, and magi squares. In Algebrai
Combinatori s and Appli ations.
[Car99 F. Caruso. A Ma syma Implementation of Zeilberger's Fast Algorithm.
SFB-Report 99-16, RISC, J.K. University, Linz, Austria, 1999.
[Chy98 F. Chyzak. Fon tions holonomes en al ul formel. PhD thesis, INRIA
(Fran e), May 27 1998. Th`ese universitaire no. TU 0531.
[Cus89 T.W. Cusi k. Re urren es for sums of powers of binomial oe ients.
J. Combin. Theory Ser. A, 52(1):77{83, 1989.
[GCL92 O.K. Geddes, R.S. Czapor, and G. Labahn. Algorithms for Computer
Algebra. Kluwer, 1992.
[GKP94 R. Graham, D. Knuth, and O. Patashnik. Con rete Mathemati s A Foundation for Computer S ien e. Addition Wesley, se ond edition,
1994.
[GNU GNU Proje t. GMP on line do umentation. Available at
http://www.swox. om/gmp/.
[Gos78 R.W. Gosper. De ision pro edure for inde nite hypergeometri summation. In Pro eedings of the National A ademy of S ien es of USA,
number 75, pages 40{42, 1978.
[GvzG99 J. Gerhard and J. von zur Gathen. Modern Computer Algebra. Cambridge University Press, 1999.
[Kar86 P.W. Karlsson. On two hypergeometri summation formulas onje tured
by Gosper. Simon Stevin, 60(4):329{337, 1986.
[Lip81 J.D. Lipson. Algebra and Algebrai Computing. Addison-Wesley, Reading, Massa husetts, 1981.
[Ma 16 P.A. Ma Mahon. Combinatory Analysis, volume 2. Cambridge University Press, 1915-1916. Reprinted: Chelsea, New York, 1960.
[Ma 96 Ma syma, In . Mathemati s and System Referen e Manual, sixteenth
edition, 1996.
[Pau95 P. Paule. Greatest fa torial fa torization and symboli summation. J.
of Symboli Computation, (20):235{268, 1995.
[Pet92 M. Petkovsek. Hypergeometri solutions of linear re urren es with polynomial oe ients. J. of Symboli Computation, (14):243{264, 1992.

BIBLIOGRAPHY

157

[PR97 P. Paule and A. Riese. A Mathemati a q-Analogue of Zeilberger's


Algorithm Based on an Algebrai ally Motivated Approa h to qHypergeometri Teles oping. Spe ial Fun tions, q-Series and Related
Topi s, Fields Institute Communi ations, (14):179{210, 1997.
[PS95 P. Paule and M. S horn. A Mathemati a Version of Zeilberger's Algorithm for Proving Binomial Coe ient Identities. J. of Symboli Computation, (20):673{698, 1995.
[PS00 C. Pau and W. S hreiner. Distributed Mathemati a - User and Referen e
Manual. RISC Report 00-25, RISC, J.K. University, Linz, Austria, 2000.
[PWZ97 M. Petkovsek, H. Wilf, and D. Zeilberger. A=B. A K Peters, MA,
1997.
[Rie01 A. Riese. Fine-Tuning Zeilberger's Algorithm: The Methods of Automati Filtering and Creative Substituting. In F.G. Garvan and M.E.H.
Ismail, editors, Symboli Computation, Number Theory, Spe ial Fun tions, Physi s and Combinatori , volume 4 of Developments in Mathemati s, pages 243{254. Kluwer, 2001.
[RZ A. Riese and B. Zimmermann. Randomization Speeds up Hypergeometri Summation. Preprint.
[S h W.F. S helter. Maxima on line do umentation. Available at
http://www.ma.utexas.edu/maxima/index.html
http://maxima.sour eforge.net/referen emanual/maxima to .html.
[S h95 M. S horn. Contributions to Symboli Summation, De ember 1995.
[Sho V. Shoup. NTL on line do umentation. Available at
http://www.shoup.net/ntl/.
[Sta97 R.P. Stanley. Enumerative Combinatori s, volume I. Cambridge University Press, 1997.
[Str94a V. Strehl. Binomial identities { ombinatorial and algorithmi aspe ts.
DMATH: Dis rete Mathemati s, 136, 1994.
[Str94b V. Strehl. Binomial identities - ombinatorial and algorithmi al aspe ts.
Dis rete Mathemati s, (136):309{346, 1994.
[Win96 F. Winkler. Polynomial Algorithms in Computer Algebra. SpringerWienNewYork, 1996.
[Wol99 S. Wolfram. The Mathemati a Book, fourth edition, 1999.

158

BIBLIOGRAPHY

[Yan98 T. Yan. The Geobu ket Data Stru ture for Polynomials. J. Symboli
Computation, 25(3):285{293, Mar h 1998.
[Zei90 D. Zeilberger. A fast algorithm for proving terminating hypergeometri
identities. Dis rete Mathemati s, (80):207{211, 1990.
[Zei91 D. Zeilberger. The method of reating teles oping. J. of Symboli Computation, (11):195{204, 1991.

Index
 , 38

1i, 108
A(H ), 69
B (H ), 69
C (H ), 69
Cb (i), 98
Ci (M; b), 38
Comp, 104
D(F (n; k); d), 91
D(H ), 69
H (A), 44
k , 106
Qk , 80
Qn, 80
D (H ), 75
dp (x), 114
(H ), 76
i;j , 98
den, 80
dom, 70
evalv , 57
evalx, 45
F^ (n; k), 80
Q^ k , 87
Q^ n , 87
im, 70
m , 39
L, 80
modp, 40
H , 74
 (A), 57
num, 80
H , 70, 74
H , 75
revd , 98
 , 107

``?'',

60
Abramov's method, 17
Algorithm, 60{63
algorithm
addition to geobu ket, 126
division
by generating fun tions, 122
by powers of polynomials, 125
Newton, 122, 123
s hool, 100
division by powers of polynomials
by generating fun tions, 122
exponentiation
by generating fun tions, 122, 125
by repeated squaring, 125
extended Eu lidean, 53{55, 57, 66
row of, 53
generalized extended Eu lidean,
53{55, 57, 66
Gosper, 15
Gosper Form, 83
multipli ation
by geobu kets, 126
Karatsuba, 122, 123
polynomial evaluation
Horner, 32
Zeilberger, 17
AllD, 51
ba k-substitution, 41, 43, 57, 99
bije tion
fundamental, 70
binomial theorem, 26
bla k list, 58
159

160
Bla kList,

60, 61, 64
bubble sort, 111
C++ omponent, 120
anoni alization, 127
Cau hy interpolation, 54
Chinese remainder
problem, 42, 147
theorem, 37, 42, 47, 49, 51
ChNullSpa eAt, 49, 50
ChNullSpa eUntil, 50
lient, 121
ombination, 110
without repetitions, 110
ombinatorial proof, 109
CompleteNullSpa e, 62, 64
omposition, 104
on atenation, 104
on atenation of a omposition, 104
Cramer matrix, 38
Cramer's rule, 41
CramerNullSpa e.m, 49
d-reversed polynomial, 98, 138
DegreeBound, 60, 61, 64
diagram relation, 107
transitive and re exive losure, 107
diophantine
equations, 1
inequalities, 1
DistChNullSpa eUntil, 50, 51
Distributed Mathemati a, 50
divide, 139
divide-and- onquer strategy, 123
domain, 70
expandFromFile, 137, 140
falling fa torial, 82
nite support, 17, 19, 115
forward di eren e operator, 106
fun tion
Krone ker delta, 98
sign, 107

INDEX

fundamental bije tion, 70


Gaussian elimination, 38, 41, 43, 53,
93
gbMult, 137
g d ondition, 17, 32
generalized extended Eu lidean algorithm, 53{55, 57, 66
generating fun tion, 114
geobu ket, 126
GFdivide, 139
GMP, 136, 140, 142
Gosper
ondition, 17, 84, 86, 89, 90
equation, 17, 33, 84, 89, 91
form, 20, 32, 69, 83, 84, 87{90
polynomial, 84, 89, 91, 92
Gosper, 23
Gosper's algorithm, 15
Gosper-Petkovsek
form, 84, 89
Gosper-summable, 25, 89, 90
GosperSum, 23
GosperSumVerboseOpt, 23
GosperVerbose, 23
GosperVerboseOpt, 23
Hadamard bound, 44, 46
Hamming weight, 125
heuristi method, 58
homomorphism
evaluation, 45
modular, 41
Horner's algorithm, 32
hybrid method, 58
HybridNullSpa e, 63
identity
rst Karlsson-Gosper, 27
se ond Karlsson-Gosper, 28
Strehl, 29
Vandermonde, 27
image, 70
in pla e

INDEX

expand
of a dense polynomial, 140
of a sparse polynomial, 137
produ t
of oe ients, 136
of dense polynomials, 139
of power produ ts, 135
of sparse polynomials, 136
sum
of oe ients, 135
of dense polynomials, 139
of sparse polynomials, 136
in lusion-ex lusion, 110, 112
InitializeD, 51
integer ongruen e, 39, 40, 42, 147
interpolant
polynomial, 66
rational, 55
InterpolatingRatFun tion, 66
interpolation
Cau hy, 55
delayed, 59
Lagrange, 46
Newton, 46
polynomial, 46
rational, 55
k-free re urren e, 15, 17
k-multiset, 110
k-permutation, 110
without repetition, 110
k-regular, 80
k-sequen e, 110
without repetitions, 110
k-set, 110
Karatsuba, 137, 139
Karatsuba multipli ation, 122, 123
Karlsson-Gosper
rst identity, 27
se ond identity, 28
Krone ker delta fun tion, 98
Lagrange

161
interpolating polynomial, 147
polynomial interpolation, 46, 147
largest square upper part, 37
lifting, 103
linear re urren e operator, 80
LISP, 20, 31
LOADZeilberger.ma syma, 22
lu ky
evaluation, 57
primes, 41
rationals, 45
Ma Mahon, 1
Ma syma, 20, 31
Mathemati a, 57, 59, 119
omponent, 127
interfa e, 120
parser, 120
MathLink, 121
matrix
L(A), 38
R(A), 38
modp, 40
Cramer, 38
triangular form of a, 38
MAX ORD, 24
Maxima, 20, 31
maximal ardinality property, 78
method
heuristi , 58
hybrid, 58
re ursive, 58
method (obj. or. progr.), 119
ModPower, 133
modPower, 139
modular inverse, 101, 116, 123, 134
ModularAlgorithm, 64
ModularNullSpa e, 60
modulo, 138
mpz lass, 136
MultiHybridNullSpa e, 63
MultiModularNullSpa e, 60
Mobius fun tion, 109

162
n-regular, 80

natural boundary, 17, 19


network, 50, 51
Newton
division, 122
iteration, 123, 124
formula, 124
polynomial interpolation, 46, 148
Newton, 139
non-Gosper-summable, 25
non-k-regular, 81
non-n-regular, 81
NTL, 136
NTL::ZZ, 136
Offset, 60, 64

- al ulus, 1
one(), 135
operator
forward di eren e, 106
linear re urren e, 80
shift, 3, 80
over ow, 126
Pade
approximant, 57
approximation, 56
parGosper, 24
parGosperVerboseOpt, 24
parser, 120, 128
Paule-S horn implementation, 21
Petkovsek ondition, 84
PolyComb, 119
PolynomialExpand, 132
polynomialRing, 136
post x form, 120, 121, 128{131
power produ t, 129, 135
pPostify, 130
quintuple, 32
rational erti ate, 15
rational fun tion approximation, 2,
53

INDEX

RatNullSpa e,

63
re ursive method, 58
regular, 80
repeated squaring
for polynomial exponentiation, 125
resultant, 17, 20
reversed, 138
reversed polynomial, 98, 138
rising fa torial, 82
s hool
division, 100, 139
multipli ation, 142, 143
server, 121
shift
operator, 3, 80
quotient, 14, 80
shift, 138
StartingInterpolation, 60, 64
stream, 129
Strehl identity, 29
summation
hypergeometri
de nite, 17
inde nite, 15
q - ase, 14
Symboli Algorithm, 64
teles oping, 2, 13
template, 119
term
holonomi , 20
hypergeometri , 14
proper, 15, 80
regular proper, 80
trans endental extension, 97
triangular form, 38
triangularization, 57
trinomial oe ients, 28
uniPolynomial, 137, 138
Vandermonde identity, 27
Var, 60, 61, 64

INDEX

Verbose,

60{64
WritePoly, 128, 134
Zeilberger, 24
Zeilberger's algorithm, 17
ZeilbergerVerboseOpt, 24
ZeilbergerVeryVerbose, 23
zero(), 136

163

Você também pode gostar