integer relation algorit hms and of ~umerical...
TRANSCRIPT
Integer Relation Algorit hms and the Recognition -
of ~umerical Constants
by
Alan -Meichsner
B-Sc. Mathematics, Okanagan University CoZlege, 1998
A THESIS SUBMITTED IN PARTIAL FULFILLMENT
OF THE REQUIREMENTS FOR THE DEGREE OF
MASTER OF SCIENCE in the Department
of Mathematics
@ AJan Meichsner 2001
SIMON FR4SER UNIVERSITY
June 2001
AU rights reserved. This work may not be
reproduced in whole or in part, by photocopy
os other means, without the permission of the author.
National Library Bibliothèque nationale du Canada
Acquisitions and Acquisitions et Bibliographie Services services bibliographiques
395 Wellington Street 395. nie Wellington Ottawa ON KI A O N 4 Ottawa ON K1A ON4 Canada Cétnada
The author has granted a non- exclusive licence dowing the National Library of Canada to reproduce, loan, distribute or sell copies of this thesis in microfom, paper or electroaic formats.
The author retains ownership of the copyright in this thesis. Neither the tbesis nor substantial extracts fiom it may be printed or otherwise reproduced without the author's permission.
L'auteur a accordé une kence non exclusive permettant à la Bibliothèque nationale du Canada de reproduire, prêter, distribuer ou vendre des copies de cette thèse sous la forme de rnicrofiche!.h7 de reproduction sur papier ou sur format électronique.
L'auteur conserve la propriété du droit d' auteur qui protège cette thèse. Ni la thèse ni des extraits substantiels de celle-ci ne doivent être imprimés ou autrement reproduits sans son autorisation.
Abstract
Although mathematicians commonly recognize the decimd expansions of numbers
such as a and fi, few recognize the decimd expansions of numbers such as 27r + ln(2)
or 1 + J2fa. The objective of this paper is to develop a set of algonthms that
aid in the identification of numericdly computed constants. Most of these algorithms
rely upon the ability to find a small integer relation for a vector x E IEg" when one
exists, that is a nonzero ~ e c . ~ o r m E Zn such that x m = O- Three methods for
finding integer relations are discussed: PSLQ, HJLS, and a method based on the LLL algorithm. It is also shown that PSLQ and HJLS are essentially the same and can be
viewed as nothing more t han different impIernentations of the same algorit hm.
Dedicat ion
For Nicole, who has always been there for me.
Contents
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Dedication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii ... List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vri~
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Integer Relation Algorithms . . . . . . . . . . . . . . . . . . . . . . . 8
2.1 The LLL Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.1 Finding Integer Relations with LLL . . . . . . . . . . 10
2.2 The PSLQ Algorithm . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.1 -4 Bound on the Relation Found by PSLQ . . . . . . 17
3.2.2 Termination of the Algorithm . . . . . . . . . . . . . 19
2.3 The HJLS -4lgorithm . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.1 The Relation between HJLS and PSLQ . . . . . . . 29
2.4 Practical Implementations of the PSLQ Algorithm . . . . . . . 38
2.4.1 The Basic Algorithm . . . . . . . . . . . . . . . . . . 38
2.4.2 Periodic Reductions and The Multi-Pair Algorithm . 40
2.4.3 -4 Multilevel irnplementation . . . . . . . . . . . . . 43
2.4.4 A Selection of Timings for the Various Algorithrns . 44
3 The Recognition of Numerical Constants . . . . . . . . . . . . . . . . 46
. . . . . . . . . . . . . . . . 3.1 Rational and Algebraic Numbers 47
3.1.1 Recognizing Rational Numbers . . . . . . . . . . . . 47
3.1.2 Recognizing Algebraic Numbers . . . . . . . . . . . . 48
3.1.3 From f olynomial to Radical expressions . . . . . . . 49
3.1.4 Identifj4ng Functions of Algebraic and Rationd Values 51
3.2 The Recognition of other Constants . . . . . . . . . . . . . . . 51
-4ppendices
-4 hteger Relation Algorithms (Maple Code) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A . I The LLL Algorithm
A.2 The HJLS Algonthm with Full Reductions . .. . . . . . . . . -4.3 The Basic PSLQ Algorithm . . . . . . . . . . . . . . . . . . . A.4 The PSLQ Algorithm with Periodic Full Reductions . . . . . . -4.5 A Multi-Level implementation of PSLQ . . . . . . . . . . . . .
B Recognizing numerical constants (Maple Code) . . . . . . . . . . . . . B . 1 The Reverse Engineering Calculator . . . . . . . . . . . . . . .
B.1.1 Recognizing rational values and functions of rational
values . . . . . . . . . . . . . . . . . . . . . . . . . . B . 1.2 Recognizing algebraic numbers and functions of alge-
braic numbers . . . . . . . . . . . . . . . . . . . . . . B . 1.3 Recognizing other constants . . . . . ... . . . . . . 71
8.1.4 Some Examples . . . . . . . . . . . . . . . . . . . . . 76
List of Tables
. . . . . . . . . . . . . . . 2.1 Selected timings for the various algorithms 45
. . . . . . . . . 3.1 Minimal Polynomials for Simple Radical Expressions 50
List of Figures
2.1 Pseudocode implementation of the LLL 1 . . . . . . . . . . i thm. II
2.2 Pseudocode implementation of the PSLQ Algorithm . . . . . . . . . . 16
2.3 Pseudocode implementation of the HJLS Algorithm . . . . . . . . . . 27
2.4 Pseudocode implementation of the HJLS -4lgorithm with full reduc-
tions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
. . . . . . 2.5 Pseudocode implementation of the Basic PSLQ Algorithm 39
2.6 Pseudocode implementation of the PSLQ Algorithm with periodic full
reductions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
..a
Vll l
Chapter 1
Introduction
The result of a numerical calculation can be difficult to interpret. Although one can
get a feeling for the size of a number fiom its decimal expansion, this expansion gives
little additional insight. If a simple closed form expression could be found that agreed
with the result to the given precision or the possibility that the value Ras from a
certain class could be ruled out, then this might aid in understanding the onginal
computation. The most ambitious projects so far that attempt to find closed form
expressions for numerical values are A Dzctionary of Real Numbers [5] and The Inverse
Symbolic Calculator [12]. Although both work reasonably well, the fact that they are
primarily table based impcjses some limitations. The main problem with a table based
approach is that a table has only a limited nunber of entries. Even though a certain
value may have a simple closed form expression, a table based approach wilI find it
only if it has been included in the table. A failure to find a corresponding expression
can not tell us the number is not from a given class. An additional problern with a
table based approach is that the numerical entries in the table are given to a hxed
precision. Even if the decimal expansion of a number is known to greater accuracy
than the values given in the table, these additional digits will not be used in an
attempt to i d e n t e the number. Although the expressions one gets from the table
may agree with the expansion of the number in the fist few places, they may be very
poor approximations of the original value.
Rather than taking a table based approach, we attempt to construct closed form
expressions for a numerical value using various algorithms. Although this does not
allow us to search in such a wide c l a s of numbers as the previous two projects, it
allows for more thorough searches within a given class and allows us to know exactly
what types of numbers have and have not been considered. There is, however, still no
guarantee that any of the returned expressions are the number being considered. All we are able to Say is that the returned expressions agree with the number to a given
degree of accuracy.
The main tools behind what we cover are Integer Relation Algorithms. We consider
three such algorithm in the next chapter, ail of which rely upon constructing an
appropriate sequence of bases for a given lattice.
Definition 1.1 (Integer Relation) W e say there ezlsts an integer relation between
the numbers xl, x2, . . . , x, if there exkt integers al, az, . . . , G, not al1 zero, such that
Cy=L=, aixi = O. For the vector x = [xi, x*, . . . , x,IT, the nonzero vector a E Zn is an
integer relation for x i f a x = 0-
Definition 1.2 (Lattice) The lattice L spanned by the n linearly independent vectors
b1,b2, . . . ,b, i s the set of vectors L = ( ~ ~ = , ribi : ri E Z, i = 1,2, . . . , n). W e say
that the vectors bi form a basis for L.
The following fact is useful to keep in mind when varking with lattices, it lets us know
that each successive set of vectors we consider form a basis for the original lattice.
Theorem 1.1 If bl,bz, . . . ,b, f o n a busis for the lattice L, then the vectors b;,b;,
. . . ,b', fonn a basis for L if and only if there exists an nxn znuertible mat& A with
integer coeficients and de teminant *1 sueh that B' = BA where B = [bl, b2, - - , b,] (the mat+ for which the ith column is the vector bi) and Br = [b;, b;, - - , b;].
Proof:(+) Suppose bl,ba, . . . ,b, and b; ,b;, . . . ,bk both form basis for L. Then as
each b! E L, each bi can be expressed as an integer combination of the hi's- From
this we see Br = BA for some n x n matrix A with integer entries. Similarly, as each
bi E L, B = B'C for some n x n matrix C with integer entries. As B = B' C = BAC and B' = BA = BrCA, AC = CA = I . We see that B' = BA for some invertible
CHAPTER 1. INTRODUCTION
rnatrix A with integer entries and determinant &l.
(e) Suppose bl,b2, . . . ,b, form a basis for L and A is an invertible n x n matrix with
integer entries and determinant f 1 such that Bf = BA. Clearly, each column vector
b[ of B' can be written as an integer combination of the biYs- Now as A is invertible,
has integer entnes and determinant I l , we see by the formula A-' = l a d j ( A ) det ( A )
that A-' also has integer entries and determinant Il. Thus we see B = B'A-l and
so each bi can be written as an integer combination of the bf's. The vectors bf also
form a bais for the lattice L.
Integer Relation Algonthms have also been called Multidimensional Continued
Fraction -4lgorithms and Generalized Euclidean Algorithms. -4s one can show that
applying the Continued Fraction Algorithm to the value ro/rl is equivalent to running
the Extended Euclidean Algorithm on the real numbers r o and rl , and as both can
be used to determine either a shortest integer relation for the vector x = [ro, r l] or
a lower bound on the norm of any possible integer relation for x, this suggests that
these names are appropriate. In fact, the following method for showing that these
two algorithms are equivaient and how they can be used to find a lower bound on
the norm of any possible integer relation for x also suggests how we should proceed
in developing integer relation algorithms for n > 3. Wë briefly present the details of
both algorithms for the sake of notation.
The Extended Euclidean Algonttim is applied to the values ro and rl as follows.
Begin by setting so = 1, to = O, sl = O, tl = 1 and then repeat the following process
starting with k=l :
This obviously holds for k = O and k = 1 and so by induction, as
CHAPTER 1. ZNTROD UCTION
it hoids for al1 k. -4s rk < $ r k 4 for k 2 3, either th% algorithm terminates with
rl; = stro + tkrl = O or it constructs an infinite sequence of pairs (sk , t k ) such that
skro + tkrl decreases monotonicdly to zero.
The Continued fraction algorithm is applied to the value r 0 / q in the following
manner. Bea* by setting al = (ro/r l ) , al = Lro/rlJ, po = O , qo = 1, pl = 1, pl = O and then repeat the following process beginning with k = 2:
1. Set ûrk = l and a* = Lak] a k - l - a k - ~
The nth convergent of the continued fraction is P * + ~ / Q ~ + ~ . Note that this is different
from what is usually given, the difference in the subscripts has been introduced to
simplify what follows. Either this algorithm terminates with o k E L? in which case
rO/rl = pk/qk , or this algorithm constructs an infinite sequence of convergents that
converge to ro/r l .
To show the equivalence of the Euclidean and Continued Fraction algorithms, we
consider the lines IE& = R[ro, rllT and d = R[rl, -roIT. The task is to construct
a sequence of bases for the lattice Z2 that converge to d by examining the projec-
tions of these basis vectors onto k. Starting -4th the standard basis for Z2, we let (2) (1) b(,l) = [1, 0IT and b2) = [O, 1IT. If we set B(') = [b, , b2 1, the rnatrix with column
vectors br) and bf), then
and
A = (g('))-l =
The following properties hold for k=l:
1. crk = rkdl / rk and so Qk = at
2. by) = [sk+ and b2) = [sc, trlT are the column vectors of B ( ~ )
CHAPTER 1. INTRODUCTION
(k) T = 3. (a, ) [pk: qk] and ($1)~ = bkm1, ~ k - 1 1 are the row vectars of A ( ~ ) = (B(*)) -l
Now suppose these three conditions hold for some k. Then bl) = [sk-,? &-IlT and
equal to 1
t,rl, their projections onto IE$x have norms
and d m r k ' of bases for Z2 that converge to x', we set -4s our goal is to construct a sequence
bY+') = br) and b, ('+') = bp) - ~ ~ b g ! AS T ~ + I = 7-k-1 - Qkik, this results in a new
basis for Z2 with projectiocs onto Rx having noms equal to
To maintain B(~+') = [bF+l1, b?+')] with each iteration, we rnust update the matrices
Bck) and A(') = (B('))-' as fo~lows:
-k r = (rk-l/rk - Q ~ ) Q = rk/akfl i we dso have a k + l = T ~ / T ~ + ~ and so by
induction the above three condit.ions hold for al1 k. By forcing the vectors bik) to
converge to & in this fashion, the relation between the values pk and qk from the
Continued Fraction algorithm and the values s k and tk from the Extended Euclidean
algorithm becomes clear.
~ o w for each k, [sk, hlT is orthogonal to bk, qklT and so pk/qk = -tk/sk. -4s it is
easily shown that 1 = gcd(pk, qk) = gcd(sr. tk) by showing both pkqk+i - p k + l q k and
- sk+1tk equat &l, it follows that either pk = t k and qk = -sk or p k = -tk and
q k = Sk- This, coupled with the fact that ak = T ~ - ~ / T ~ and Qk = ak for dl k shows
t h a t each step of the Ex%ended Euclidean Algorithm coincides wïth each step of the
Continued Fraction &4lgorithm. The two algorithms are equivalent.
CHAPTER 1. INTRODUCTION
Viewed in this fashion, if r k # O then it is straight forward to give a lower bound on
the size of any possible integer relation for x. AS $1 = bk, qkIT and r k = s k r o + tkrl,
Now if m is an integer relation for x, then m lies in * and so it follows that
1 a?) - m ( = 1 IProj, al) 11 1 [ml1 is a nonzero integer. ~t follows that
h the event that r k = 0' [sk, tkIT is an integer relation for x and so r0/rl = -tk/sk =
pk/qk E Q. As I = gcd(sk, Q) = gcd(pk, qk), we see that in this case we have found a
smallest possible integer relation for x.
The above method of showing the equivalence of the Euclidean and Continued
Fraction algorithrns and how to apply them to fmding integer relations between the
values XI, 2 2 , . - . , xn for n = 2 indicates how to proceed for n 2 3. Given the vector
x = [zI, x2, . . . , xnIT7 we would like to let b?), b?), - . . , bik) be a basis for Zn and then
with each successive iteration, choose a new basis in such a way that an upper bound
on the values projx b, decreases. However, as it is currently not known how to l I (k) Il select a new basis in such a way that guarantees finding a srnail integer relation when
one exists by looking only at the values prcjxbi(k) , we must do sornething different. II II Noting that the bound on the size of a smallest possible integer relation in the case
n = 2 came from looking at the projection of the vecton [pk, qk]T onto d gives the / (k) (k) correct course of action. We will conçtruct a çequence of bases {pl , , . . , a,, ) }
for the lattice Zn which converge to the line IWx by examining their projections onto (k) (k) (k) d. We will let B(k) = jbr), b r ) , . . . , bkk)], A(k) = (B(*))-', and let a, , a, , - . . , an
be the column vectors of ( ~ ( ~ 1 ) ~ . By chooçing a new basis af) , . . . , an) for Zn in
such a way that the projections of the 4" onto Y& tend to zero, we shall indirectly
force the vectors b?) to converge to & and raise a lower bound on the norm of any
possible integer relation for x. If x has integer relations, then this bound can only be
made so large before one of the b:k) lies in d and an integer relation is found. This
is the general idea behind both the PSLQ and HJLÇ algorithms that aze presented in
the next chapter.
Chapter 2
Integer Relation Algorit hms
-4lthough the Euclidean and Continued Fraction Mgorithrns solve the problem of End-
ing integer relations for the vector [xl,xz,. . . , x,] when n = 2, until recently there
were no known polynomial time algorithms that soived the problem for n 1 3. A
breakthrough was made in 1977 with Ferguson and Forcade's Generalzzed Euclidean
Algorithm [8][9], a recursive algorithm that was guaranteed to find an integer rela-
tion when one existed. Following this, a number of non-recursive algorithms were
developed, among which are the PSLQ algorithm, the HJLS algorithm, and a method
based on the LLL algorithm that s h d be covered in this chapter. Following their
presentations, we show that the HJLS algorithm can be viewed as a special case of
the later PSLQ a l g o f i t h with the parameter y = fi.
2.1 The LLL Algorithm
It is often desirable to End a basjs for a lattice L that is in some sense reduced. The
obvious choice for a reduced basis bl,b2, . . . , bn is to let bi be the shortest vector in
L that is independent of the vectors bl,bz, . . . ,bi-l. Although Gaussian reduction
finds such a basis for n = 2 [7, pg. 231 and a method due to Vallée [ l5] finds such
a basis for n = 3; currently there is no known algorithm that ni11 construct such a
basis in a reasonable amount of time for n > 3. The following alternate definition
of a reduced basis, due to Lenstra, Lenstra and Lovhz [Il], is usefd as there is an
CHAPTER 2. llVTEGER RELATION c4LGOMTHH?S
algorithm (LLL) for finding such a reduced basis.
Definition 2.1 Let bl,b3? . . . ,b, be
pi,jbj' where pi,j = (bibj') / 1 1 bj' Il2 process). We cal1 the vectors bl,b2, . -
1. lpi,j\ 5 1/2 for 15 j < i 5 n
2. IIbr + ~ i , i - i b ~ ~ l [ ~ Z 3/411b~~11~
a b a i s for the lattice L and let br = bi - ( This is the Gram-Schmidt orthogonalization
,b, LLL reduced if
Condition 1 States that the t-ectors bi must be close to orthogonal. Condition 2,
along with 1, allows us to bound the values llbjll in terms of the n o m s of the shortest
vectors in the lattice L.
Theorem 2.1 Suppose bl,b2, . . . ,b, fonn an LLL reduced bais for a lattice L. Then
for every nonzero vector x E L, we have Ilbl 1 1 $ 2(*-')/* IIxI1- In particdur, Ilbi 1 1 iS
no larger than 2("-')12 tzmes as large as the n o m of a shortest nonzero vector in L.
Proof: As the vectors bf and bLl are orthogonal, condition (2) tells us that
By condition (l), this implies llb:1I2 2 1/211bt1112 and so by induction
Now for any nonzero vector x E L, we can mite x as x = CL, qbi with 1 5 k < n, ak # 0, a d each E Z. Replacing bi with bi = bf + x;zi pijbJ allows US to write
k x = Ci=, sib: with each Si E W and sc = a* E 2. This gives
As shown in [II], one can prove that for an LLL reduced basis bl,bz, . . . ,b. and for
any set of t linearly independent vectors XI, XZ, . - . , xt E L7 we have the inequality
IIbjII 5 2 (n-')/2 max(llxlII, Ilx2117 . . , IIxtll) for 1 5 j 5 t. The details of the algorithm used to construct aa LLL reduced basis fxom an arbitrary b a i s for L are presented
in Figure 2.1.
Refemng to Figure 2.1 we see that the body of the main loop first ensures condition 1
in the definition of an LLL reduced basis is satisfied for the vectors bl, b2, . . . , bk and
then checks to see if condition 2 holds. Note that at the beginning of the main loop,
the vectors bl,ba, - . - form an LLL reduced basis for the lattice that they span.
For procjf of termination and improvements on the basic algorithm one is referred
to [ I l ] and [7].
2.1.1 Finding Integer Relations with LLL
One use of the LLL algorithm is to find small integer relations between a set of
nonzero values XI, 52, . . . ,x,. TO use the LLL algorithm to find an integer relation for
x = [xl, 2 2 , . . . , xn], define the (n+l)xn lower trapezoidal matrix B as
where N is a large number 1 O
and let bl ,b2, . - - ,bn be the column vectors of B. If we now consider the vectors in
the Iattice spanned by bl,bz, . . . ,b, we see they are of the form
We may view the last term in ml, N E %xi, as a penalty t e m . If the vector m =
[ml, ma, . . . , mn] is an integer relation for x then this term will be zero. However, if m
The LLL Algorithm This algorithm takes an arbitrary basis bl,bî, . . . ,bn for the lattice L as input and uses it to construct an LLL reduced basis.
Step 1 Initialization Let bl7bZ7 . . . ,bn be a bais for L. for i to n do
Step 2 Main Loop Repeat
for j from (k - 1) downto 1 do q := [pk (nearest integer) bk := bk - qbj for i t0 j do pk,i := pk,i - qpj,i end do
end do If 11&11* 2 (3/4 - & , k - i ) b ~ - l ~
then set k := k + 1 else interchange bk and bk-l.
Update br, bi-,, llb;1I2, [lbL-1112 and the p$s as follows:
for i from k + 1 to n do
set k := max(2, k - 1) end if
until k = n + 1 -4t this point, the vectors bl,b2,. . . ,bn fonn an LLL. reduced basis for the lattice L.
Figure 2.1: Pseudocode implementation of the LLL Algorithm
CHAPTER 2. 1-WTEGER RELATION ALGORITHMS 12
is not an integer relation for x then this term will be large provided N is large enough.
The penalty for not being an integer relation depends on the choice of -N. If N is
taken large enough and m is a short integer relation for x, then m' will be one of the
shortest vectors in L. With this in mind, to find an integer relation for x we choose
a suitably large d u e of ;V and run the LLL algorithm on the vectors bl,b2, . . . ,b,. The first vector ; b;, in the returned basis will be one of the smdes t vectors in L. (Note that b; is not necessarily the shortest vector in the returned basis. We may
also wish to consider the other b; as well). From b; we c m pick off the coefficients
of the suspected integer relation m for x. It is important to realize that m may not
be an integer relation for x. This method can fail to return a d d relation fcr one
of two reasons, the first being that x has no integer relations, and the second being
that N was not large enough.
Lernma 2.1 Suppose there are integer relations for x = [xl, x2, . . . , z,lT. Then the
method presenteà above will find one provided N zs large enough.
Proof: Let M be the n o m of a smallest integer relation for x and consider the finite
set of vectors {y E Zn : llyll < z ~ / * M , (y x) # O). From this nonempty set, choose a
vector y with the property that [y - xl = yixi 1 is minimal. For this y, choose N so
that N yjxil > 2"I2M. NOW for =y m' E L, if W X i # O then Ilrn'll > Z " / ~ A ~ .
If m = [mi, m1,. . . , is not an integer relation for x, then the n o m of the vector
m' = [ml, m ~ , . . . , m,, .NE mixiIT is greater than 2((n+1)-1)/2 tirnes as large as the
norm of a shortest nonzero vector in L and hence can not be the first vector in an
LLL reduced bais by Theorem 2.1.
Aithough this shows that an integer relation will be found if one exists and 1V is large
enough, we do not h o w before hand how large AT must be.
2.2 The PSLQ Algorithm
Folloiving the Generalited Euclidean Algorithm [SI, Ferguson developed a sequence
of nonrecursive integer relation algonthms [IO] [2] [4], each an improvement on the
CHAPTER 2. INTEGER RELATION ALGORITHMS 13
previous ones. In this section we cover the latest incarnation of these, a simplified
statement of the PSLQ algorithm. Although we follow the general cutline of [4], we
try to provide more motivation for each step of the algorithm and place a greater
emphasis on xL. This gives a better picture of how the steps fit together and allows
for a clearer statement of the prooh of Theorem 2.2 and Lemma 2.2. The proof of
termination has also been extended to cover the case when x has no integer relations
of norm l e s than some constant T. -4s before, suppose we wish to find a small integer relation between the nonzero
values xl, xs, . . . , xn. Ratheï than using the method of the previous section: based
upon the LLL algorithm, we instead consider the ideas laid out at the end of the
introduction.
Let x = [xl, x2, . - . , x,IT and suppose we have a set of n linearly independent
wctors ai, a=, . . . , a, E Zn such that the projection of each ai onto XL is srnall (we
Say each vector a; is close to x). If we define A to be the matrix such that the i th row
of A is aiT, then A is invertible. Let B = A-' and let bj be the j th column vector of
B. Now as (ai . bj) = O for i # j and each ai is close to x, we w-ould expect that each
bj lies close to d. The idea behind the PSLQ algorithm is to start with the standard
basis for the Zattice Zn and with each iteration, construct a new basis al,az, . . - ,a,
for Zn in which the ai are closer to x. In doing SO, we hope to force the vectors bj
closer to x!-. LVe will see that as an upper bound on the values proj ai decreases, Il II a lower bound on the size of any possible integer relation for x increases. Throughout
the PSLQ algorithm we work with the following matrices:
A: An n x n invertible matrix. The column vectors ai of AT form a bais for Zn.
H : -4n nx (n-1) matrix with column vectors hj that form an orthonormal basis for d
H f : The mat& A H . Each entry hij in H f is the inner product of aj with hj. Note
that the projection of ai onto XL is (ai - hj) hi Each time we begin the
main iteration of the algorithm, H f wil1 be lower trapezoidal (see Definition 2.2)
and we ~ i l l have 1 hij 1 < 1/2 1 hij 1 for 1 5 i < j. This will give
By reducing the 1 we will reduce an upper bound on proj ai for each i. II II B: B = A-'. The column vectors bj of B wïll be forced closer to xL by forcing the
vectors closer to x.
Defmition 2.2 (Lower Trapezoidal) The rn x n mat* C is Zower trapezoidai i f
m > n and each e n t q y; of C equak zero if j > i.
Aithough forcing the vectors ai closer to x is not sufficient to guarantee one of
the bj will eventually lie in d, termination of the algorithm and a bound on the size
of the relation found will follow with some work theorem 2.2. From this theorem we
will see that reducing the values 1 h;] also increases a lower bound on the n o m of the
smallest possible integer relation for x-
Theorem 2.2 Let A be an invertible nxn matriz with integer coeficients, x a vector
in Rn, and H an nx (n-1) mat* with colurnn vectors that f o n a n orthononnul baszs
for d . If H f = AH 2s lower trapezoidal wzth each diagonal # O then - 1
5 11 mil for any integer relation m of x. max 1 hiyi 1
Proof: For any integer relation m, HHTm = m as HHT is the projection matrix
onto d. Thus A m = H ' ( H T m ) . Let qT be the ith row vector of A, hiT be the ith row
vector of HT, and hij the j t h diagonal element of H f . -4s A is invertible, A m # O.
Let j be the least integer such that aFm # O. Then a;fm = O for 1 5 k < j and so by
recursion and the fact that H' is lower trapezoidal with nonzero diagonal elements,
hkm = O for 1 5 k < j and aTm = h: JhTm). As q r n is a nonzero integer,
The last inequality coming fiom the fact that the norm of the projection of m onto
the unit vector hj can not be larger than the norm of m. The result now follows.
The details of the PSLQ algorithm are presented in figure 2.2. hlthough one cm
implement the algorithm in such a way that requires only the matrices B and H f , the
matrices A and H are included as they make it easier to follow the reasoning behind
the various steps. While the version presented here is valid only for real vectors x, it
can easily be extended to work with cornplex vectors as well [4].
Note that in step 1, partial sums of squares of the xi are used to construct the
matrix H . It can be seen that the column vectors hi of H form an orthonormal basis
for x' by considering (X - hi) and (hi - hj) for i 5 i, j 5 n - 1. By examining the
definitions of the hi and si in step 1 of the algorithm we see the followhg:
F o r l _ < i S n - l n n
si+ 1 - X k X i (X - hi) = ~ i h i , i + C zkhkli = x i - + C ~ k -
k=i+l si k=i+l S iS i+ i
For l < i < n - 1
The matrix H we start with has the desired property, its columns form an orthonormal
bais for d. At the beginning of step 1 of the algorithm we set the constant y > v/4/3/4/3 This
requires an explanation. -4s stated above, if me reduce the values 1 hili 1 for each i, then
CHAPTER 2- IYTEGER RELATION ALGOMTHMS
The PSLQ Algorithm This algonthm takes a vector xT = [x l , 22, . . . , xn] and a constant T 2 1 as input. It either returns an integer relation for x dong with a lower bound on the n o m of the shortest integer relation or it returns a lower bound (2 T) on the norm of any possible relation for x.
Step 1: Initialization Fix the constant y so y > Let A = B = 1; aiT the ith row of A, bj the j t h column of B. Let H and H' be the nx(n-1) lower trapzoidal matrices with entries
O l i i < j < n - 1 n = h, = si+, / s i 1 < i = j < n- l where s,? =Czi
1 $ j < i 5 n k j
Let hf be the ith row vector of H' and let hi be the ithe column vector of H.
Step 2: Size Reduce H' for i from 2 to n do, for j from i - 1 downto 1 do
set t = Lhia/h>.J replace ai with ai - taj, bj with bj + tbi, and with hi - th:
"
end do, end do
Step 3: The Main Iteration Choose r so that 7' lh:,il is maximal when i = r . Repeat the following until either ma ,- , -
,*-
> T or both hk,-, = O and r = n - 1:
1- Let a = h;,, k? = h;,,,, and X = h;+,,+, . Then interchange rows and %T+l of A, columns b, and br+= of B, and rows and w,, of Hl.
3. If T = n - 1 then H' is still lower trapezoidal. In this case the value of Ih,-ll,-ll was reduced by at least a factor of 2. If r < n - 1 then H' is no longer trapezoidal. Remedy this by rnodiSing the ba i s for x-k Rotate h, and hr,= in the plane they define so that the projection of a, onto hrtl is O. This is done by replacing H by HQ and H r by H'Q where Q is the (ml ) x(n-1) u n i t q mat& difined as follows:
Set Q = In-1 and let 6 = d m . Then set qqr = B/67 qr+, , = X/6, q,,r+i = - A / & , and qr+,,r+, = P/6.
In addition to setting h: ,r,, to 0, this sets h i , = 6 and h;,,,,,, = -crX/6. 3. Size reduce H' as in Step 2. 4. Choose r so that y' 1 h& 1 is maximal as above.
Step 4: Return 1 / max 1 hili 1 as a iower bound on the norm of any integer relation for x. If r = n - 1 and hnqn-, = O then return b,-i as an integer relation for x.
Figure 2.2: Pseudocode implementation of the PSLQ Algorithm
CHAPTER 2- INTEGER RELATION ALGORTTHMS
we reduce an upper bound on the values proj and increase a lower bound on Il II the size of the srnallest possible n o m for &y integeirelation of x. Now as r is chosen
so that y' [h:,rl is as large as possible, if T < n - 1 then 1 1 5 $ l h b l In th's
case we let o! = h;,,, ,8 = hk+l,r, X = h~+l ,r+l , and set 6 = d m . We then replace
h:,, with 6. Rom the reduction of H f we have that 1 h:,,, 1 5 $ 1 h:,. 1 which then gives
Thus 1 hi,,l is reduced as long as ,/; + 45, < 1 or y > m. Although this also in-
crea~es 1 hk+~,~+ll (as h : + ~ ~ ~ + l is replaced with - d l 6 and 1 h~,,h:+,,r,l 1 = 16 crX/bl = [dl remains unchanged, we see that (h:,,,,, 1 increases), this is not a significant
problem. At each step WC are forcing the larger diagonal elements of H' towards
4 - 1 , n - 1 where their size can be reduced by at least a factor of 2 when r = n - 1- Even though we strive to reduce the diagonal entries of H', none will ever equal
zero. From the fact that hivi # O initially for any i, and as h i , and hk+,,r+l are
replaced with nonzero values when r < n - 1, the only way a value hiyi may become
zero is if we interchange rows hn-l and hn of H f when b,,-, = O. However, as we
would exit the algorithm before this interchange occurred, the diagonal elements of
H f are dways nonzero. We need not concern ourselves about divisions by zero when
computing Lhi Jhij l during the reductions of H f .
Now, in the event that the algorithm terminates with h,,,-l = 0 , the column vector
bn-l of B is an integer relation for x. To see this, recall that x T H = O, BA = 1, AH =
H' and h~-,,,-, # O. This gives O = xTBHf = [xT~h;,xTBh;, . . . , x ~ B ~ L - ~ ] where
& is the i th column vector of H f . As the only nonzero entry in hk-, is hk-,,,-,, we
have O = ~ ~ b ~ - ~ h ~ - ~ , , - ~ which yields xTbn-l = O. The (n-1)st column vector of B
is an integer relation for x.
2.2.1 A Bound on the Relation Found by PSLQ
We have just shown that if the PSLQ algorithm terminates with h& = O, then the
column vector b,-l of B is an integer relation for x. As we are looking for a small
CHAPTER 2. INTEGER RELATION ALGONTH-US
integer relation, we would like to show that the relation found is not much larger than
the smallest possible integer relation for x. To do this, we need the folloming lemma.
Lemma 2.2 If the PSLQ algorithm terminates with hk,,-l equalïng zero, then the
n o m of b,-l, the integer relation found, is
Proof: Let el, e2, . . . , en be the standard orthonormal basis for Rn and ei, e;, . . . , e',-, be the standard orthonormal basis for 1R-l. As b,-l is an integer relation for x,
( ~ H ~ ) b , - l = bn-,. Using the facts that A H = H' and b,-1 is the (n-1)st column
of B = A-' we see that
where ( H r ) t is the left inverse of H f . We know H' has a left inverse because the row
vectors of the lower trapezoidal matrix Hf span Rn-'. How-ever, as the only nonzero
element in the last column of H f is h~-,,,_,, the (n-1)st column of the (n-1) x n matrix
( H f ) t must be equal to 1 en-, = [O, 0, . . . , O hk-1,n-1
IT. The linear combination ' h L - l , n - ~
of the rows of H' required to constnict e? can not use the (n-1)st row of H f when
i # n - 1 and must have a multiple of times the (n-l)st row when i = n - 1. hL1.n-1
It follows that
Now, as b,-l lies in Y?- and the rows of HT form aa orthonormal basis for xi, we see
that I(H Tb,-lII = Ilbn-1 1 1 which gives the result we are after:
Armed with this lernma it becomes a simple matter to find a bound on the size of an
integer relation found by the PSLQ algorithm.
Theorem 2.3 Let M be the norm of the smallest integer relation f o r x. If the PSLQ algorithm t e m i n a t e s because h&, = O and r = n - 1, then
Proof: By lemma 2.2, we know that llb.-lll = 1 . As r = n - 1, we have J h L 1-n- 1 1 1 for 1 5 i 5 a- 1. From Theorem 2.2, as none of the diagonal
M 2 RR for some j and so
We cannot guarantee the PSLQ algorithm will return a smdlest integer relation for
x. However, if we have rnax 1 1 = 1 1 upon termination, then we have found
an integer relation for x of smallest possible norm. It shouId be noted that if we stop
the algorithm when h& = O but before r = n - 1, then the above bound does
not apply. Although b,-l wi11 still be an integer relation for x with norm equal to
l/lh>.-,,,-,l, this norm may not be as small as we can make it. If we continue until
T = n - 1, then we rnay increase the value 1 hn-l,n-l 1 (it will not decrease) and hence
decrease the norm of b,-l.
2 -2.2 Termination of the Algorithm
K e first consider the case when the vector x has integer relations. In this case,
termination of the algorithm rests upon the result of Theorem 2.2 and the method
used to reduce the diagonal elements of H f . To begin, define r so that
CK4PTER 2- ZNTEGER RELATION ALGORTTHlMS
In step 1 of the dgorithm, y was chosen so that 7 > J4/3 and thus we see that
T > 1. TO show that the algorithm terminates we show that IT(k), a function of the
diagonal elements of H', is bounded and increases with each iteration.
Definition 2.3 Let hiVi(k) be the i th diagonal element of H f ut the end of the k th
iteration for k 3 1 und let h:yï(0) be the i t h diagonal element of H' at the beginning of
the first iteration. Let y be as chosen in step 1 and let M be the n o m of a smallest
integer relation for then dimensional uector x. Then define n(k) to be
The following lemma shows that the function Il@) is bounded.
Lemma 2.3 At the end of the k th iterat2on (k > O ) we have that
Proof: From step 1 of the algorithm we see that
Now suppose that at the beginning of the kth iteration Ih&(k)( 5 1 for each i. Then
if r = n - 1 only Ih~-l ,n-,(k)l changes and is reduced by at least a factor of 2. If
r < n - 1 then only 1 h:,Jk) 1 and 1 h;+,,+,(k) 1 change. As was shown previously
in equation 2.1, (ht,(k) 1 is replaced with the smaller value 161 and 1 h:,,,,, ( k ) 1 is
replaced with 191 < a = h ) 1. Thus Ihili(k+ l)l 5 1 for 1 5 i 5 n - 1. We see that for each i and k 2 O, 1 h l 1 1 As both y and M are larger than
1 it follows that for any k 2 0, rnin(yn-lM, &q ) 2 1 for 1 5 i 5 n - 1. This
establishes one of the desired inequalities, 1 5 II(k) for each
For the second inequality, note that
and so
i= 1
- n(n-1) As z = - = (2) we have the required result. 2
CX4PTER 2. INTEGER RELATION ALGORITHMS
Before showing that II(k) increases by at least a factor of T with each iteration,
we need the folowing lemma.
Lemma 2.4 Suppose the positive constants a, b and t satisfy the following inequali-
Proof: The proof is a simple verification. If one lists off all 24 possible orderings of
a, b, 1, and t and then crosses off those orderings where it is possible to have a < b,
a < t, or 1 < t , then only the following 5 orderings remain:
a L b L l > t
a > _ l > b > t
a l l l t z b
l l a l b l t
l > a > t z b
Wit h t hese remaining orderings one easily checks t hat the desired inequality holds.
Lemma 2.5 For any k 2 O, n ( k + 1) 2 rII(k).
ProoE We will show tthat the quotient n ( k + l)/II(k) is greater than or equal to T.
When r < n - 1, the following 2 x 2 submatrix of H f
where 6 = d m - . -411 other diagonal elements of H f remain unchanged. It follows
that in this case
CK4PTER 2. INTEGER RELATION ALGORITHMS
If we make the substitutions a = y"-' M 161 and b = yn-'M [XI, then we have
Now as 6 = 2 IXI, a 2 b and as y > &@, equation 2.1 shows that
Id/crl < 1. By Theorem 2.2 and the choice of r we also have that M 2 1/ lh;jl for
some j and y' la1 2 y' 1 hi,+ 1 for 1 5 i 5 n - 1. As y > 1 th% implies that
or equivalently t hat p
As the conditions of lemma 2.4 are satisfied, we see that
Otherwise we have 1 > a 2 16/al and so
from equation 2.2 above. From the definition of T we see that l/r2 > lly2 or that
y > r . T h u s i f r < T L - 1 then
If r = n - 1 then the only diagonal of H f that changes is hk-,,n-, ( = Icr[. In this case
me have Ih&+, (k + 1)1 la112 and so
CHAPTER 2. INTEGER RELATION -4LGORTTHMS
Again, from equation 2.2 we have yn-'Mlcrl 3 y 2 1. Nom as l/r2 = 1/4+ l/y2 > 1/4, 2 > T and so if y"-'M la1 2 2 then
On the other hand, if 2 > yn-'M Io1 2 1 we have
So, if T = n - 1 we also bave
We are now in a position to give bounds on both the number of iterations required to
find an integer relation for x and the number of exact arithmetic operations required
to find this relation.
Theorem 2.4 If the vector x has integer ~elations, then the PSLQ algorithm vil1 find
one in less than (:) 10dY; -W iterations
where M is the n o m of a shortest relation for x, y is as chosen in step 1 of the
algorithm, and r > 1 2s defined by 1/r2 = 1/4 + l/y2. Proof: Suppose we have completed k iterations of the algorithm and have not yet
found an integer relation for x. Then from lemma 2.5 we see that
From lemma 2.3 it follows that
Nom- as T > 1 we have
log T
CK4PTER 2. INTEGER RELATION ALGORlTHMS
Corollary 2.1 If x has integer relations then the PSLQ algorithm can be made to
find one vsing
O (n4 + n3 log M)
ezact arithmetic operations.
Proof: From the above tbeorem, we see that the PSLQ algorithm takes less than n2+n ((n-1) log r+log M ) -
2 log r or O (n3 + n2 log M) iterations. Examinhg the algorithm we see
that parts 1, 2, and 4 of the main iteration can be completed using O(n) exact
arithmetic operations and part 3, the size reduction of Hr, requires 0(n3). Thus the
algorithm as given requires 0(n6 + n5 log M) exact arithmetic operations. However, if
we examine the proof of lemma 2.5 we see that the full reduction of the matrix H f is not
necessary- Al1 that is required for this proof to go through is that 1 hi,, 1 5 1/2 1 hivi 1 for 1 < i < n - 1. If we make this chmge to the algorithm then part 3 can be
completed in O(nj exact arithrnetic operations as well. Thus if x has integer relations
then the PSLQ algorithm can be made to find one in 0(n4+n3 log M) exact arithmetic
operations.
Although we can modie part 3 of the main iteration so that it requires only O(n) exact
arithmetic operations, this was not done as our final goal is to implement the PSLQ algorithm using inexact arithmetic. If we do not do a full reduction of the matrix Hr,
but instead only do a partial reduction then the algorithm becomes unstable. More
is said on this matter when we discuss the HJLS algorithm and its relation to PSLQ.
The proof of termination of the algorithm when x has no integer relations of norm
less than T is very s imi ls and requires only cosmetic changes. In this case we define
a new function II*(k) as
Il* (K) = n [ ~ n i n ( - + ~ - ' ~ , )ln-'. i= 1 1 h:,i (k) 1
CHAPTER 2- Lh-TEGER RELATION .UGORITHMS
Exactly as in lemma 2.3 we have that
Now rather than using theorem 2.2 in lemma 2.5, we instead use the fact that if the
algorithm has not tenninated after the kth iteration, then there is at least one j such
that
If we redefine a acd b so that
a = -yn-'Tb and b = +yn-'?' [XI
then equation 2.2 becomes
or equivalently,
Everything carries through as before- We see that
The results of this section are summarized in the following theorem:
Theorem 2.5 Let p = min(M, T ) where T is the bound passed to the PSLQ algorithm
and M is the n o m of a srnullest integer relation fo r x (if x has no integer relations
then Af = oo). T h e n the PSLQ algorithm will terminate in less than
iterations. Upon termination, the algorithm d l either r e t u n an integer relation for
x of n o m no larger than yn-2M or return a lover bound 2 T on the n o m of ang,
integer relation for x.
CHAPTER 2. INTEGER RELATION ALGORITHMS
The fact that the PSLQ algonthm can return a lower bound on the size of an integer
relation for x is very useful. For instance, Bailey and PloufFe use this to show that if
Euler's constant satisfies an integer polynomial of degree 50 or Iess: then the Euclidean
nom of the coefficients must exceed 7 x 10" [3]. This is an advantage that the PSLQ
algorithm has over LLL.
2.3 The HJLS Algorithm
Initidly given the preferable name of T h e Smalt Integer Relatzon Algon'thm, HJLS is an integer relation algorithm developed by Hastad, Just , Lagarias, and Schnorr [Ml.
As with the PSLQ algonthm, it is based on work stemming from Ferguson and For-
cade's Generalzzed Euclidean Algorithm [SI. The idea behind HJLS is again to con-
struct a sequence of bases for the lattice Zn in such a way that a lower bound on
the size of any possible integer relation for x = [xl, x2, . . - , x,IT increases. Following
the initial paper, we present the details of the algorithm in Figure 2.3 and give a
brief proof of the algorithms correctness. The proof of termination and a bound on
the number of iterations required is essentially the same as that given for the PSLQ
algorithm and will be omitted.
Theorem 2.6 The HJLS algorithm correctly returns either an integer relation for x
o r the value 2' crs a Zower bound o n the n o m of a n y possible relation. I f an integer
relation is found, it is n o more than t imes as large as the srnallest possible
relation for x.
Proof: Suppose the HJLS algorithm terminates with Il<l[ # O. This implies that
Il 11 = O for some i < n and so the vectors x = a, al, . - . ; 4-1 form a linearly dependent set. As the vectors al, a2, . . . , a,+l are linearly independent, we see that
x E span(al, a2,. . . , hVl) and so b, lies in zd as bn is orthogonal to each ai for
1 5 i $ n - 1. In the event that 11% 11 # O, HJLS correctly returns an integer relation
for x.
If HJLS terminates with II<II = O, then Il<ll 5 2-' for each i. Now if m is an
integer relation for x, then m E J& = span(a;, 4,. . . , <-J and so m . # O for at
The HJLS Algorithm This algorithm takes a vector x = [xi, x2, . . . , xnIT and a constant k as input. It either returns an integer relation for x or shows that x has no integer relations of norm less than 2k-
Step 1 hitialization Set A = B = In- Let aT be the ith row vector of A and bi be the ith column vector of B Set 4 = x and =ai - CizkpClija; for i = 1, . .. ,n
ai -a?
where pi j = IIay # 0 O Ila;Il = O
The vectors a;, a& . . . , span d. If I l < l l = O then return bn as an integer relation for x.
Step 2 Repeat
Choose the value r that maximizes 2'11af1I2 for 1 5 T 5 n. Partial Reduction: (Ensure Ip,+l, 1 5 1/2)
Set ++l = &+1 - T P ~ + ~ . ~ I * Set b,+l = b,+: + rfi+l,r]b, to maintain B = A-' Update the values p,+lY;, 1 5 i 5 r
Exchailge and Update: Exchange rom and qT+, of A. Exchange columns b, and b,+l of B. U ~ d a t e II$II?<+i: Ilq+ill, ~ + i , r 7 and the values pc, and pi,?+~ for r +- 2 5 i 5 n.
Until l l < j l # 0 or I l $ l l 5 2-& for al1 i with 1 5 i 5 n.
If IlGll # O then return bn as an integer relation for x. Otherwise return 2* as a lower bound on the norm of any possible integer relation for x.
Figure 2-3: Pseudocode implernentation of the HJLS -Algorithm
CHAPTER 2. INTEGER RELATION ALGORITHMS
least one i with 1 5 i 5 n - 1. Choose the smallest i such that m a* # O. Then
rn -a; = m - ai E Z and so as Ilrnllll<ll 2 lm 2 1, we have jlrnll 2 l/ll<ll. Thus the norm of any integer relation for x must be greater t han 1 / max Il 1 1 2 2'.
For the last portion of the proof, suppose that b, is an integer relation found by
the HJLS algorithm. Then as above, both < and b, are orthogonal to the vectors
X, a l , . . . , G-1 and so = cb, for some constant c. It follows that Ilbnll l l < l l =
Ibn = Ibn hl = 1 or llbnll = l/lla;ill- NOW in the event that # O initially,
1 1 bn 1 1 = 1 and so b, is a srnallest integer relation for x. If = O initidy, then let (k) +(k) a , . . . , a,, , a , . . . , ai'*) be the vectors al, . . . , G, a;, . . . , at the beginnuig of
(kf 1) the final iteration, let a, , . . . an (k+l), a;("'), . . . , a, be the vectors al,. . . , %,
a;, . . . , < a t the end of the final iteration, and let m be any integer relation for
x- We know that llrnll 2 l/ max l l < ( k ) l l and that for the final iteration when a
relation is found, r = n - 1. With this choice of T , the partial reduction step sets 1 - (k) (k+l) = a, (k) (k) (k) *(k+l) - c h - r and %-i + p n As this results in a, # O and
x7 ,...y&$!:1) do not change, we have that G-, *(k+lj = O and so an *@+il - *(k) - %-1- so
for 1 5 i < n.
JS"-211mll. A relation
Now by choice of r , 211<(k))112 5 ~'lja,'(~)li~ 5 and
*(Cl 2 < y - 2 1 Ilai I I - l l ~ ? ! I I* = 2-2 ll@+l) 112 = 2-2 llbnIl2
*(k) 1 1 we have the desired result, libnll 5 -4s Ilrnll 2 l/max
found by the HJLS algorithm is no more than times as large as the srnallest
integer relation for x.
I
Note that there is nothing special that requires having a power of 2 for the lower
bound found by HJLS. This lower bound on the norm of any possible integer relation
for x is only a consequence of the termination condition which can be modified.
As in the proof of termination for the PSLQ algorithm, the HJLS algonthm d l
terminate provided we always have Ipr+l,r 1 5 112 before exchanging a, and b+i. Due
to this fact, the authors daim that having Ipi , j l 5 112 for al l i > j is unnecessary in
the real number mode1 of computation and so implement their algorithm with only
a partial reduction done at each step. This is unfortunate as it Ieads to numerical
CHAPTER 2. INTEGER RELATlON ALGORITHMS 29
instability in the algorithm when implemented ait h inexact &thmetic operations.
As they explain that the objective of their algonthm is to construct a sequence of
bases for the Iattice Zn that converge strongly to the line Wx (the sequence of vectors
{ai) converges strongly to the line IWr if proj ai + O), it is fair to say that if II II we irnplement HJLS with fidl reductions, which actually forces the projections of the
ba i s vectors to tend to zero? then we simply have another implementation of the
HJLS algorithm. The authors of PSLQ must agree with this as to get the better
bound cn the number of iterations required, they work with an implementation of
PSLQ that only performs a partial reduction at each step and still cal1 it the PSLQ
algorit hm.
2.3.1 The Relation between HJLS and PSLQ
In [4], the authors claim that HJLS is not a special case of the later PSLQ algodthm
with 7 = a. To support their claim they give taro examples where the performance
of PSLQ and HJLS differ. If we consider the algebraic number a = 3'j4 - 21'4, then
the vector
[l: 0 ,0 ,0 , -3860,0,0,0, -666,0,0,0, -20,O. 0, O, lIT
is an integer relation for the vector
as the minimal polynomial for a is x16 - 20x12 - 666x8 - 3860x4 + 1. They state that
PSLQ, with y = fi, finds this relation with a working precision of 85 decimal digits
while HJLS requires more than 10,000. As further evidence, they consider finding an
integer relation for the vector [ I l , 27, 31IT7 a case when exact arithmetic can easily
be used. Here, they show that for PSLQ with y = fi, the successive iterations
k = 0 ,1 ,2 ,3 ,4 field the five A-' matrices
CHAPTER 2- INTEGER RELATION ALGORTTH-MS
The first two columns of the last rnatrix are integer relation for [ll, 27, 31IT. The
HJLS algorithm requires 6 iterations for whicli iterations k = 0,1,2,3,4,5,6 produce
the seven A-' matrices
With exact arithmetic, the PSLQ algorithm constructs two relations after only 4
iterations while the HJLS algorithm constructs only one and requires 6 iterations. As
this appears to show that the PSLQ and HJLS algorithms behave differently, both
in the case when inexact arithmetic is used and when exact arithmetic is used, the
authoe of [4] claim HJLS and PSLQ are different. They suggest that the difference
may be due to the fact that PSLQ uses an orthogonal decomposition based on QR factorization while HJLS uses a decomposition which follows the classical method of
Gram-Schmidt. This is not the case. The differences observed here are due to the
partial reduction rather than full reduction done in the given implementation of HJLS.
W e shall show that HJLS with full reductions is equivalent to PSLQ with y = fi and then comment on these examples.
Following shortly, we will give the details for implementing HJLS with 3 hl1
reduction at the end of each iteration, ensuring Ipijl 5 1/2 for al1 i > j, j= 1 , . . . ,n-1.
With the intent of making it easier to show the two algorithms are equivalent, we make
the reasonable assumption that no component of x equals zero and at each stage we
normalize the vectors a;, a& . . . , c-,. The vectors h, = </Il< Il for 1 5 i 5 n- 1 form
an orthonormal basis for d at the beginning of each iteration as none of the = O
for 1 SiSn-1 until the end of the h a 1 iteration when an-, = O. Let X be the n x n
CHAPTER 2. LNTEGER RELATION ALGORITHMS
mat* such that the ith column vector of H is for 1 SiSn-1 and the nth coIum.
of H is the zero vector. Then let M be the lomer triangular matrix A H where is
the ith row vector of A. For each entry mij of M 7
and so
As mili = 11 and Il< 11 = O, selecting a value of r that maximizes 2'11a; JI2 for
1 5 i 5 n is equident to selecting an r that maximizes h i , , for 1 5 i 5 n - 1 and
ensuring lpi 5 1/2 is equivalent to ensuring j / m j ,j) 5 1/2. NOW with this choice
of T , after exchanging a, with ++1 we need to update hr7 b+l and the values mi3 to
maintain hi = g'/[lg/,'ll for lsisn-i and rnij = (ai - hi)- *(k) (k) (k) First, suppose < n - 1. Let d k ) ), ai , 4. , pij ), snd m!:) qua1 ai a,', hi pi j ,
and mij at the beginning of the kth iteration and let a superscript ('1 denote the
variable after interchanging a, with ++, . Define a, p, A and 6 as follows:
and
* 2 * 2 * ( k ) / / 2 = II = I I II + , r / l l I I ) Ilar
CHAPTER 2, INTEGER RELATION ALGORITHLMS
If we define the n x n matrix S so that
1 i = j # r o r r + l
pl6 i = j = r
S i j = - 6 i = j = r + i
X/6 i = r + l , j = r and i = r , j = r t l
ot herwise
then H(k)S=
-4s If(') = H(")s and ~ ( ~ ' 1 = E A ( ~ ) where E is the nxn elementary matrix that
interchanges rows r and r + 1, ~ ( ~ ' 1 = A ( ~ ' ) H ( ~ ' ) = E M ( ~ ) s .
Interchanging rows r and r + 1 of M and then multiplying on the right by S and
multiplying X on the right by S correctly updates the matrices M and H, maintaining
both for 15 i 5 n- 1
O for i = n
CHa4PTER 2. INTEGER RELATION -4LGORITHMS
Following this, we will apply a full reduction to the matrix M to maintain Ipijl =
lmi ,j/mj 5 1/2. We will reduce M in the same manner we use to reduce the matrk
Hr in the PSLQ algonthm which will not change the vectors At the start of
the (k+l)st iteration, hik+') = Q") for each i. *(k') *(W # O, In the event that r = n - 1, then either <Yi) = O or +-, # 0. If a,+'
then this reduces to the previous case. However, if = O then we no longer have
e:\ = <f;)/llgklll. Although this is of Little consequence as the algonthm will
terminate after this iteration, we can avoid this situation altogether by modifying the
*(*') = a;(') + p ~ ~ - l < f ~ , in order for fi) to equal zero termination condit ion. -4s q-, (k) we must have had P,,~-, = O, or equivalently, = O. Rather than waiting for
# O we can save a single iteration by tenninating when m,,,-1 = O and r = n - 1.
With this modified termination condition, at the beginning and end of each iteration
h, = a*/[l<ll for 1 5 i < n - 1, h, = 0, and mij = (ai - hj ) = bjlla*l[. It foliows
that the HJLS algorithm with full reductions is equivalent to the algorithm presented
in Figure 2.4. When implemented using inexact arithmetic, some care must be taken
ahen checking for the condition m,7n-l = O. -4s m,,n-l = (a, - hn-l), we d l claim
m,,,-l = O if (a - 3) = m,l,-l/llh 1 1 < E where the value e depends on the level IlanIl I b n 1
of precision being used.
Comparing this algonthm t o the PSLQ algorithm in Figure 2.2 with y = fi, one
sees many sirnilarities. In particular we have the following:
Theorem 2.7 For each iteration, the m a t h A from the HJLS algorithm with full
reductions and the mat+ -4 from the PSLQ algorithm are the same and up to sign,
the cohmn vectors of the mat& H from PSLQ are the same as the first n - 1 column
vectors of the rnatrix H from HJLS.
Proof: Let dB-") (dPlk)) denote the i th column vector of the rnatrix AT h m the (Plk) HJLS (PSLQ) algorithm at the beginning of the kth iteration, and let (hj )
denote the j th column vector of the matrix H from the HJLS (PSLQ) algonthm at
the beginning of the kth iteration. Let a superscript of k = O denote the vector at ( H a the end of the step 1. Initially, both algorithms set A = 1, and so a, = dP'" for
(Pt01 (P70) 1 5 i 5 n. Now by construction, hk:? is orthogonal to the vectors x, a, , . . . , a,+2
CHAPTER 2. EVTEGER RELATION ALGOMTHMS
The HJLS Algorithm with Full Reductions This algorithm takes a vector x = [xl, 22, . . . , xnIT and a constant T as input. It either returns an integer relation for x dong with a lower bound on the norm of a shortest integer relation or shows x has no integer relations of norm less than T.
S tep I Initialization Set A = B = H = I n . Let ai be the ith column vector of and bi be the ith column vector of B Set ho = x/llxll, entry h,,, of H to 0, and let hi be the ith row vector of H=. For j f r on~ 1 to n-1 do (Gram-Schmidt)
j - 1 hj set hj = hj - Ck=,( . hk)hk set hj = hj/llhjll
end do. Set M = A H = H as A =In Let mi be the ith row vector of M and mij the (i, j ) t h entry of M
Step 2 Size Reduction of M for i from 2 to n do, for j from i - 1 to 1 do
S e t t = / T L j ,jl replace ivith ai - taj, bj with bj + tbi, and mj *th - tmj
end do, end do
Step 3: The Main Iteration Choose r so that &ni,i is maximal when i = r. Repeat the following until either l / m a ~ ( m , ~ ) 2 S or both rn,,-l = O and r =n-l
2. interchange rows +T and %T+T,, of A. columns b, and b,+l of B, and rows m, and m,+~ of M.
3. Replace H with HS and M with MS
4. Size reduce M as in Step 2.
5 . Choose r so that &mi+ is maximal as above.
Step 4: Return l/ mzy(mili) as a lower bound on the norm of any integer relation for x. If mn,,-l = O then return b,-l as an integer relation for x.
Figure 2.4: Pseudocode implementation of the HJLS -4lgorithm with full reductions
CH-4PTER 2. INTEGER RELATION ALGOMTHMS 35
(a 0) (HAN (&O) A~ each = ~ P 1 o ) and and is orthogonal to the vectors x, al , - . , +-2 - ( H 0 ) the vectors x, a ~ H ~ O ) , . - - , a,+'2 are lineady independent, we see t hat hi:!) is a scalar
multiple of g?:). As both are unit vectors and initially the diagonal elements of X
-1 *
( H 0 ) in both PSLQ and HJLS are positive, g?:) = QRyO) Similady, as the vector h, (ff 0) (H 0) is orthogonal to x, a i H y o ) , . . . , a& , and k-.'l and the vector hn?:) is orthogonal to
x, a l o ) , . . . , d'.",), and G::) we have G?:) = G'.:). Contiming in t his fashion, we
see that 4(K10) = g P 7 O ) for 1 < i 5 n - 1. As Ht=AH in PSLQ, M=-4H in HJLS, and as the reduction in step 2 is the same
in both algonthms, when we enter the main iteration for the first time we have d H y l ) = 4"') for 1 5 i 5 n and h,!Hyl) = hiPy1) for 1 < i 5 n - 1.
(H*) = *4(PYk) for New suppose for some k 2 1, d H C ) = de" for 1 5 i 5 n and hi 1 5 i 5 n - 1. Then in both dgonthms, the same value is chosen for r. First, suppose
r < n - 1. Let d H s k ) , , x ( ~ , ~ ) , and b(Hyk) be the values assigned to a, j? A, and 6 in the HJLS algorithm and let dPyk) , fi(prk), ~ ( ~ y * ) , and be the values assigned to
a, p A, and 6 in the PSLQ algorithm. One of the four conditions holds:
(P,k+l) After exchanging aYy" and d?:), the PSLQ algorithm updates the vectors h,
and G::+') as follows:
CH-4PTER 2. INTEGER RELATION ALGORITHMS 36
- One easily checks that in al1 4 cases, h!H'k+l) - ho'+') and 4+i ( H + + l ) - - + ( H ~ + L ) . - kg ( H , k + l ) the other basis vectors for & do not change, - - &4(p1k+1) for 1 5 i 5 n - 1.
Now upon entering the reduction stage, which is the same in both algorithms, the
column vectors of the matrix H f = AH in the PSLQ algorithm are the same, up to
sign, as the first n - 1 column vectors of M = A H in the HJLS algorithm. It follows (H*k+-1) - ( P * k + l ) that [mi,j/mj J = Lh:j/hijJ a t each step of the reduction and so ai -a,
for 1s i 5 n. then the PSLQ algorithm does not change its H rnatrix and so hlPyk) =
5 i 5 n- 1. However, the HJLS algonthm updates g?f+l) and hiHvk+')
this situation, ~ ( ~ 7 ~ ) = O and 6(n*k) = I @ H * k ) l and so
We again have hi (H7*+L) = f hLPykf l ) for 1 5 i 5 n - 1 and so as above, the Reduction
step maintains dHykfl ) = d P p k f l ) for 1 5 i < - n.
As B = A-' in both algorithms and as M = A H in HJLS and H f = A H in PSLQ, we
see there is a direct relation between the matrices A, B, M, and X from HJLS and
the matrices A, B, H f , and H fkom PSLQ. At each iteration, both algorithms have
the same (up to sign) orthonormal ba i s for d, the same basis for the lattice Zn: and
both update these bases in an identical fashion with the intent of making the basis
vectors for Zn converge to x. Each step of one algorithm corresponds exactly with
each step of the other. The PSLQ algorithm with y = f i is equii-alent to the HJLS
algont hm wit h full reductions.
CHAPTER 2. LNTEGER RELATION ALGORITHMS 3'7
If we appIy the HJLS algonthm with fuU reductions to the two examples given at
the beginning of this section, we get the following results:
For a = 3'/' - 2'14, the HJLS algorithm successfully recovers the integer relation
for the vector
using less than 85 digits of precision which is consistent with the results from the
PSLQ algorithm.
For the vector x = [11,27, 31lT, the HJLS algorithm requires 5 iterations to find the
integer relation [-1,5, -4IT. Iterations k = 0,1,2,3,4 and 5 produce the six B = A-' matrices
3 -2 O -1 -8 -2 -6 -1 -2
L -2 -1 -1 -4 -5 -4 -1
Note that the first five matrices are identical to those given for the PSLQ algorithm.
The extra matrix is due to the fact that the authors of PSLQ have modified their
termination condition so that the algorithm terminates as soon as one of the column
vectors of B = A-' is an integer relation for x. Although doing this may Save a few
iterations and still return an integer relation, it causes us to lose the ability to Say
that the norm of the recovered relation is no more than T ~ - ~ times as large as the
norm of a smallest possible integer relation for x. For instance, in this example, the
integer relation [-8,9, -5IT has a n o m equal to which is greater than fia where is the norm of [-1,5, -4IT. III this example. the shorter relation is also
recovered but we have no guarantee in the general case that this will happen.
CHAPTER 2. llVTEGER RELATION ALGOMTHMS 38
2.4 Practical Implementations of the PSLQ Algo-
Given a set of values xi, x;, . . . , xk in symbolic form, it is often far too costly to find
an integer relation using exact arithmetic operations. Instead, we would like to let the
values xi, 5 2 , - - - , xn be good rational approximations of xi, zb, . . . , x: and attempt to
h d an integer relation for x = [xl, 5 2 , - . - , xnlT using inexact arithmetic. As stated
in [l], a simple information theory argument gives a lower bound on the number of
digits of precision that must be used. If we wish to recover a relation a E ZR with
coefficients of at most d digits in size, then the coefficients of x must be given to
a t least nd digits. Although this simple lower bound is often too low, the PSLQ
algorithm usually recovers a given relation using only about 15% more digits than
this bound suggests are necessary. Pu'ow in the event that we do recover a suspected
relation a E Zn using inexact arithmetic, there is no guarantee that it is a true integer
relation for x'. If the values xi, xb, . . . , x; are cornputed to twice the precision and a
still appears to be an integer relation, then this gives us strong reason to believe that
it is. While this cannot prove that a is an integer relation for x', it suggests that it
may be worthwhile to search for a rigorous proof to show that it is.
In what follows, we present a selection of implernentations for PSLQ using inexact
arithmetic. In light of the last section, everything that is said here can also be applied
to the HJLS algorithm.
2.4.1 The Basic Algorithm
We begin with the basic implementation of the PSLQ algorithm, similar to that
given in [4], [3], and [Il. The details are presented in Figure 2.5. Note that the only
signific.mt differences between this implementation and the statement of the algorithm
given in Figure 2.2 are that here the matrices A and H have been omitted and the
termination condition has been modified. Rather than waiting until r = n - 1 and
h;,,-, = O, termination occurs as soon as x - bj = O for some column vector bj
of B. Although any returned relations tend to be small in practice, this modified
CHAPTER 2. LiVTEGER RELATION ALGORITHMS
The Basic PSLQ Algorithm This algorithm takes a vector xT = [xl, x,, . - . , x,] and a constant T 2 1 as input. It either retums a suspected integer relation for x or a lower bound (3 T) on the n o m of any possible relation for x.
Step 1: Initialization Fix the constant y so that y > -m Let B = I and let bj the j t h column vector of B. Let hli be the ith row vector of Hf where the entries of H' are defined as follows:
Set y = x/[lxll and let Yi be the zth component of y.
Step 2: Size Reduce H' for i from 2 to n do, for j from i - 1 downto 1 do
set t = Lh;Jh>J Replace bj ~ i t h bj + tbi, hi with hf - th(,, a d yj with y j + t g i
end do, end do
Step 3: The Main Iteration Repeat the follonring until either maxih. . 2 T or min& < E: I :*a I
1. Choose r so that y' 1 hivi 1 is maximal when i = r. Then interchange columns b. and b.+l of B, rows h: and q+, of Hfy and entries y, and y,,, of y.
Set Q! = h:+~,~, B = hi,,, -Y = h:,r+l, and 6 = for i from r to n do
set t = hi,,, h;, = gh:,, + ih:,,,,,, and = -$t + Eh! 6 Z,T+I end do
3. Size reduce Hf For i from r+l to n do, for j from min@ - 1,r+ 1) downto 1 do
set t = Lh&-/h>31 Replace bj with bj + tbi, hi with h: - th; and yj with yj + ty i
end do, end do
Step 4: If m i n z < E then return the corresponding bj as an integer relation for x, llbj II
otherwise return hc . % as a lower bound on the norm of any relation for x.
Figure 2.5: Pseudocode implementation of the Basic PSLQ Algorithm
CH-4PTER 2. IhTTEGER RELATION ALGOMTHMS
termination condition causes us to lose the ability to claim that they have n o m no
larger than yn-2M where M is the n o m of a smallest integer relation for x.
Again, some care must be taken when checking to see if x - bj = O . We shall ciaim
x - bj = O when " - < E where e depends on the level of precision being used. If Ilxll ilbj Il we look only at the values yj = bj - then we may miss a relation. If llbjll is large
enough, then bj & may be larger than the given value of E. As i t is undesirable to
require the calculation of the values 11 bj 1 1 for 1 5 j 5 n with each iteration, it is noted
that in practice the values yj tend to stay within a few orders of magnitude of each
other and gradually decrease until one of the bj is an integer relation for x. As one
would expect, when bj - x = O the corresponding value yj suddenly decreases. Rather
than checking al1 the values yj/lJ bj 11 to see if one is less thaa c, we can select the value
j such that yj is minimal and look only at the corresponding value of yj / l l bj 11.
2.4.2 Periodic Reductions and The Multi-Pair Algorithm
For a first improvement to the basic algorithm, we note that the full reductions of
the matrix H' are the bottle neck. As the standard HJLS algorithm shows, we c m
not omit the full reductions altogether as this causes severe numericd instability. We
can, however, perform them periodically and still achieve good results. Rather than
full? reducing the rnatrix H' at each step, we will perform a full reduction only when
T = n - 1. If r < n - 1 then we will perform a partial reduction prior to exchanging
h, and h,+l to ensure that 1 hk+,,rl 5 [h:, , l /2. The details of the PSLQ zlgorithrn
with periodic reductions are presented in Figure 2.6
On a similar note, but with an eye towards a parallel implementation, Bailey
and Broadhurst have introduced a variant of PSLQ which they cal1 the Multi-Pair
algorithm [l]. The idea behind this variant is to first select a number of disjoint pairs
(ri. ri + 1) and then perform the normal operations of PSLQ on each pair with r = ri.
One can easily do this in such a way that the operations from one pair do not affect the
operations of another as the pairs are disjoint. In addition, they have also reordered
the steps in which the full reduction of the matrix H' are performed. Even though
i t has been designed for a parallel implementation, when run on a single processor
CHAPTER 2- INTEGER RELATION ALGORITHMS
The PSLQ Algorit hm wit h Periodic Reductions This algorithm takes a vector xT = [x17 x2, . . . y xn] and a constant T 2 1 as input. It either r e t u m a suspected integer relation for x or a lower bound (2 T) on the norm of any possible relation for x-
Step 1: Initialization (see Figure 2.5)
Step 2: Size Reduce H f (see Figure 2.5)
Step 3: The Main Iteration Repeat the following until either l 3 T or min f i < c:
maxlh:,i 1 1. set doFullReduction=false
while doFullReduction=false do Choose T so that y' 1 h&l is maximal when i = r .
se t t = Lh:+l,,l~:.,l and let b, = b. + tb,+=, w+, = q+, - tq, and y, = y, + t ~ , + ~ . Interchange columns b, and b.+= of B, rows h: and &+l of H f , and entries y, and y,+i of y. I f r < n - 1 then
set = hi+,,,, @ = hLYr7 = h:,,,,, and 6 = for i £rom r t o n do
else doFullReduction=true
end if end do
2. Size reduce H f as in Step 2 above
Step 4: If min& < E then return the corresponding bj as an integer relation for x: othenvise return ,e max . as a lower bound on the norm of any relation for x.
Figure 2.6: Pseudocode implementation of the PSLQ Algorithm with periodic full reductions
C W T E R 2. INTEGER RELATION ALGORITHMS
the Multi-Pair algorithm offers an improvement to the basic algorithm. However, in
this case it amounts to little more t h m the PSLQ algorîthm with periodic reductions
and a poor selection procedure. The selection procedure used in the algorithm is as
f0Uows:
1. Sort the entries of the (n-1)-long vector {-yi 1 h:,i 1 } in decreasing order, producing
the sort indices.
2. Beginning a t the sort index ri corresponding to the largest y' 1 select pairs
of indices (ri, ri + 1) ; where ri is the sort index. If at any step either ri or ri + 1
has already been selected, pass to the next index in the Iist. Continue until
either the maximum number of pairs desired has been selected, or the list is
exhausted.
It has been reported that for certain problems, the Multi-Pair algorithm falls into a
cycle. Examining the selection criterion, we see that although we pass to the next
index in the list if either or ri + 1 has dready been selected, we do aUow pairs
(ri, ri + 1) where ri + 1 has already been passed over. We allow pairs (ri, ri + 1) where 1 hLiJi 1 9 y 1 h:,+,,ri+, 1. If we restrict ourselves to pairs where either ri = n - 1 or 1 h:i,ri 1 > 7 1 h:,+ll,+l 1 then we cannot fall into a cycle. This cari be shown by
considéring the product P = n::. _;' h& ln-i. First : consider the pair (ri, Ti + 1) where ri < n - 1. Let û. = h:, ,ri, B = h:i+l,ri,
X = h:i+,,ri+l, and let 6 = Then as $ a2/4, X2 < a2/-y2? and lly2 < 3/4 we have
As the algorithm replaces = a and h:i+,,ri+l = X with the values 6 and - a X / d , at the end of the iteration the term 1 h:. . In-" 1 h:i+l r.+l 1 Tt-ri-1
a > % Y a in the product P has been decreased.
In the case when ri = n - 1, the algorithm simply exchanges rows h', and of H f , resulting in a decrease of the value 1 h~-,,,-, 1 by a t least a factor of 2. Here, the
term Ihk-l,n-,l of the product P decreases as well.
CHAPTER 2. LNTEGER RELATION ALGORITHMS
This shows that P = r z i [h:ln-' decreases with each iteration of the multi-
pair algorithm provided we add the restriction 1 hk. .. 1 > y 1 h:,,,,,,, 1 to our selection t ? I
procedure. -4s the product P strictly decreases with each iteration, we can not fall
into a cycle.
2.4.3 A Multilevel implement ation
Although using periodic full reductions can reduce the time required to execute the
PSLQ algorithm, run times can still be excessively long for large problems. As a
further improvement we consider a multileïel irnplementation[l], an implementation
in which the majority of the calculations are done using low precision arithmetic.
Even though this introduces a significant amount of additional overhead, it drastically
reduces the time spent within the main iteration and results in an overall savings.
To apply such a scheme, we first perform the usual initialization and reduction
steps to produce the full precision versions of B, Hl, and y. We then let Hi be the
double precision equivalent of Hf/ rnax 1 hij l , y be the double precision equivalent
of y/ min lyil and repeat the following until either a relation is found or the desired
bound on the n o m of any possible integer relation is achieved:
1. Using only double precision arithmetic, set both A and B equal to 1 and repeat --
the main iteration of PSLQ with periodic full reductions on the matrices B, H f , - A, and the vector Y. Note that to maintain A = (B)-', when we interchange
columns 6, and Gr+, of B, we must interchange rows 3 and $'-, of A and -
when we set bj = bj + tbi ~e must set & = 4 - taj- Stop when either a relation is found, min lgij < Z, or rnax laij 1 > j~ where good
choices for the values E and jï are 10-l2 and IO'*. The reason for requiring a
bound on the integral entries of A is that if they become too large, then they
can no longer be accurately stored.
- 2. Returning to full precision arithmetic, let B = BB, Hr = AH', and y = xB.
Then let y be the double precision equivdent of y/ min [yi( and let be the
double precision equivalent of H t / rnax 1 hij 1. Using double precision, perform
an LQ factorization of the matrix Hi and set Hi equal to L.
CHAPTER 2. INTEGER RELATrON ALGORITHMS
For fidl detaiis of the multi-level PSLQ algonthm, see Appendix A.5. -4 three level
scheme is also o u t h e d in 111.
It is of interest to note that the code is in some sense self correcting. Even if some
errors are introduced within the double precision loop, causing incorrect choices of
t and r, we may recover 60m this. -4s long as the matrices À and B have integral
entries and LQ factorization of ÂH' produces a matrïx L for ahich the maximum
diagonal entry has decreased, then we have increased a lower bound on the norm of
any possible integer reiation for x and have everything we need to proceed. Even with
srnall errors a t the double precision level, we rnay still move forward and recover an
integer relation or an appropriate lower bound.
2.4.4 A Selection of Timings for the Various Algorithms
To give a brief idea of the relative efficiency of the algonthms considered, we present
a smdl selection of timings. Although we have only covered the basic LLL algorithm,
timings are also presented for Maple's lin-dep routine, an efficient routine based on
the integral LLL algorithm.
For the timings, the three algebraic numbers al = 3'14 - 21j4, a2 = -3l/= + 21/5
and as = 31/5 + 21/6 were considered. As the minimal polynomials of these numbers
are
and
we see that there exist integer relations for the vectors = [l, ai, a,?, . . . , a;n'IT where
ni = 16, n~ = 25 and na = 30. Both the time and number of digits required to recover
these relations are presented in Table 2.1. These were found by successively reducing
CK4PTER 2. LNTEGER RELATION ALGORTTHMS 45
Wit h full reduct ions PSLQ (7 = JZ)
The Basic AJgorithm Periodic Full Reductions Ivlulti-level scheme
PSLQ (y = J4/3) The Basic Algorithm Periodic Full Rductions Multi-level scheme
Table 2.1: Selected timings for the various algorithms
Algorithm LLL
The Basic Algorithm Maple's lin-dep routine
HJLS
the number of digits in incrernents of 5 until an incorrect relation was returned. The
time and number of digits used in the last correct run appear in the table. Al1
algorithms were implemented in Maple V Release 5 and run on a machine with a
600 mhz pentium III processor.
Although iilteger relation algorithms are used only for the purpose of recognizing
numerical constants in this paper, additional applications can be found in [l! and [6].
cul = 3114 - 21/4 a 2 - -31/5 + 21/5 a3 - - 31/5+ 21/6 Digits
60 60
Digits
130 140
Digits
435 315
1
Time
10-8 s 3.1 s
Tim e
94.9 s 34.5 s
Tirne
1672.2 s 296.1 s
Chapter 3
The Recognition of Numerical
Constants
\Ve are now in a position to tackle the problem of recognizing numerical constants.
Given a tnincated decimal expansion of a number, we would like to construct a simple
closed form expression for which the original number is a good approximation. The
most ambitious project so far that attempts to find these closed form expressions is
The Inverse Symbolzc Calculator(1SC) [12]. The ISC is a set of programs and special-
ized tables of mathematical constants dedicated to the identification of real numbers.
It contains more than 40 tables holding over 50 million constants which are used to
facilitate a simple table look-up approach. The ISC is capable of performing over 200
transformations on the input pnor to a cornparison with table entries. Although the
ISC gives the option to use an integer relation algorithm in its attempt to find closed
form expressions, its approach to number recognition is primarily table based. In this
chapter we take an algorithmic approach to the problem. This has the advantage
of filling in the unavoidable gaps one finds in tables and in some cases, it alIows us
to say that a number is not from a certain class. However, the drawback is that it
severely limits the classes of numbers we c m search through. An irnplementation of
the procedures presented can be found in Appendix B.
3.1 Rational and Algebraic Numbers
We begin with the simplest classes of numbers to recognize, the rational and algebraic
numbers. These are the easiest to construct closed form expressions for as each has a
defining property that aids in its identification.
3.1.1 Recognizing Rational Numbers
Given a truncated decimal expansion n of the value s, we would like to decide whether
or not x is rational. Although we cannot make any claims with certainty that are
based only on the value T, we d l clairn x is rational if there exists small integers p
and q such that p / q is a good approximation of s. As a number is rational if and only if it has either a terminating or repeating dec-
imal expansion, one method to search for appropriate values of p and q is to examine
and see if it appears periodic. However, in order for such a method to succeed, jc
must contain at least one complete penod. This is not a reasonable expectation as
it is possible for rational numbers with small denominators to have decimal expan-
sions with long periods. For example, the decimal expansion of 13/877 has a period
of length 438. It is unreasonable to expect that we ail1 have enough digits in the
expansion of I to contain a complete penod. -4 further problem with this method is
that a failure cannot be used to rule out the possibility that there exist small integers
p and q with p / q being a good rational approximation of z. Instead, we will consider
the continued fraction convergents of z which have the following qualities [13]:
1. For any rational number r / s and continued fraction convergent pk/qk of 2,
if 1s - r / s l i Ir - p k / ~ k I then Isl > q k .
2. For any continued fraction convergent pk/qk of Z, 12 - pk/qk 1 i l / qg
I t should be noted that although these results are usually given for the convergents
of an irrational number, they also hold for the convergents of rational values.
11% will define a convergent of to be a good, small rational approximation of 3
if ! - p 5 e where E is the maximum error we are willing to tolerate and the
CHAPTER 3. THE RECOGNITION OF ,WMEMCC.lL CONST4NTS
number of digits in qk is less than or equal to 1/3 the number of digits to which
we know T. If E is small enough, then this is roughly equivalent to requiring both
13 - pk/qk[ 5 E and 135 - pk/qkl < l / q : where we have increased the exponent of qk to
3 in order to single out exceptional convergents.
To h d a good, small rational approximation of 35, we only need to compute the
continued fraction convergents of Z until either IZ - pk/qk 1 5 a or the number of
digits in qk is greater than 1/3 the number of digits to which me know Z. If this
process terminates with the length of qk less than or equal io 1 / 3 the length of z, then 15 - pk/qk 1 5 c and so pk/qk satisfies our definition of a good, small rational
approximation. In this case we will claim x is the rational number pk/qk .
On the other band, if the process terminates with the length of qk greater than
1/3 the length of 5, then we shall consider the convergent pk-l/qk-l of Z- -4s
I Z - p k - ~ / q ~ - ~ 1 > C, there exist no rational values r/s such that Isl < q k - ~ and [T - r/sl 5 E . We can claim that Z is not a rational number with denominator less
than or equal to qk-1 and so we will daim x is not a small rational number. Even
though IZ - pk-l/qk-l 1 > E , the convergent ~ ~ - ~ / q ~ - ~ may stiU be of interest to us
when looking for functions of srnall rationals that are good approximations of the
input.
3.1.2 Recognizing Algebraic Numbers
Again, given a truncated decimal expansion of the value x, we ~ ~ o u l d like to decide
if x is algebraic. As an algebraic numbeï is a root of its minimal polynomial there is
an obvious way to proceed. If we can find an irreduzible polynomial p with integer
coefficients for which : is a good approximation of a root, and p is in some sense
simple compared to 5, then we d l Say x is algebraic and identi& it as a root of p.
We wilvill daim z is a good approximation of a root a if (a - 21 5 E where E is the
maximum error we are willing to tolerate and we will claim p is simple compared to
z if the total number of digits in the coefficients of p is no more than 1 / 3 the number
of digits in T. Although there is çome reason behind the choice of 1 / 3 in the rational
case, the choice here is completely arbitrary.
CHAPTER 3. THE RECOGNITION OF NUMERICAL COMTWVTS
As suggested in the last chapter, we shall try to construct a minimal polynomial
for x by looking for a relation between the powers of Lj;. Starting with n=2 and
using the PSLQ algorithm, we will try to construct an integer relation for the vector
[l, T, . . . , plT- If a suspected relation is returned, then we need to examine the corre-
sponding polpomial p. If T is a good approximation for a root of p, p is irreducible,
and p is simple in cornparison to T, then we shdl Say x is an algebraic number and
identify it as a root of p. On the other hand, if the PSLQ algorithm returns a lower
bound T on the n o m of any possible integer relation, then we can daim there does
not exist a polynomial of degree n and height less than T for which a is a root.
With each failure to h d an integer relation, we can increment the value of n
and try again. Mthough the implementation git-en in Appendur B looks only for
polynomials of degree less than or equal to 6, this method can be used to find a
minimal polynomial of arbitrary degree provided we are given the value z to high
enough precision.
3.1.3 From Polynomial t O Radical expressions
In the event that x is algebraic and has a simple radical expression, it is in some sense
unsatisS.ing to return only its minimal polynomial p. Rat her t han tryhg to determine
if p is solvable, solving, and then deciding whether the roots are simple, we shall take
an easier approach. We will define what we mean by a simple radical expression before
hand and see what restrictions this places on p. As our implementation looks only
for polynomials of degree 6 or less, we MI1 define radical expressions of the following
form to be simple provided a, b and c are srnall rational numbers:
a =t Jn, a* fi+ + I l 3 .
For a rational value r / s in reduced form, define the size of r i s to be the maximum
of the number of digits in r and the number of digits in S. We will Say a, b and c
CHAPTER 3. THE RECOGNITION OF NU&iEHCC41; CONSTANTS 50
degree
2
expression
x = a ~ &
Table 3.1: Minimal Polynomials for Simple Radical Expressions
are small rational numbers if the sum of the sizes of a , b and c is no more than 1/3
the number of digits in z. The minimal po lpomid for each of our simple radical
expressions is presented in table 3.1. It is a straight fonvard exercise to compare p to
these minimal polynomials and determine if p has a root of the desired form.
As it is possible to have both z = a f and x = a & fi f fi, we
will claim the second form is simpler as the radicals are not nested. Comparing
coefficients of the minimal polynomials for these forms, we see that for a f JKfi to equal a f. f i I fi, we must have m + n = b and mn = 4 4 , or equivalently,
m = ( b + d G ) / 2 and n = (b - JbZTC)/2. If we determine that x is of the
form a I d m where (b2 - c ) is a perfect square, then we e l 1 instead claim that
CHAPTER 3. THE RECOGNITION OF NUMER.lC.4L CONSTANTS
3.1.4 Identieing Functions of Algebraic and Rational Values
Followhg the lead given by the ISC, we can apply a set cf simple transformations to
the input before attempting to identify it. This is the approach we shall use to identiQ
functions of small rational and algebraic numbers. Given a decimal approximation
T of x and an invertible function F, we will first check to see if z is in the domain
of F-'. If it is, then we will set jj = F-'(z) and apply the previous methods for
identifying rational and algebraic numbers to
When looking for an approximation a of y, it is not critical to retiirn what we
consider to be a good approximation. Depending on the slope of the function F at
y, the difference between a and may not reflect the difference between F(a) and 2.
We will instead focus mainly on finding a small rational or algebraic approximation
for y and then check to see if both a is in the domain of F and IF(&) - 21 5 e where
e is the maximum error we are willing to tolerate. In the event that this difference is
less than c, we will claim x is the value F (a).
In our implementation, we consider the following functions: sin, arcsin, cos, arccos,
tan, arctan, csc, arccsc, sec, arcsec, cot, arccot, sinh, arcsinh, cosh, arccosh, tanh,
arctanh, csch, Z 'CCSC~, sech, arcsech, coth, arccoth, exp, ln, and the LambertW func-
tion. The inverse of each of these functions is readily available from Maple's invfunc
array- Any function for which one can compute the inverse cari easily be added. It is
important to realize that a failure of this method can not rule out the possibility that
x = F ( a ) for some srnall rational or algebraic number a. If a is not in the range of
the inverse function, then this method will not succeed.
3.2 The Recognition of other Constants
Given an approximation a of the value x, if x is neither rational nor algebraic, then we
will attempt to identiSr it by trying to construct an integer relation between T and a set
of preselected constants. If one has some insight into what constants rnay be related
to x, then the chance of success can be increased. Now suppose cl? c*, . . . , C, are the
constants we have selected and [-ao, al , . . . , a,]* is a suspected integer relation for the
CHAPTER 3. THE RECOGNITION OF hrUMERICAL CONSTANTS
vector [z, cl, c2, . . . , c,]~ in which a0 does not equal zero. Let e be the maximum error
we are willing to tolerate in an approximation of 5 and let the size of a rational number
r / s be as given in section 3.1.3. In the event that Z - ($cl + z c 2 + . . . + 2%) 1 5 e I and the sum of the sizes of the nonzero rationals 2 is no more than 1/3 the number
of digits in Z, we will claim x is the value (%ci + 2 c 2 + . . . + 2%)- Again, the choice
of 1/3 as a neasure of simplicity is arbitrary.
In our implementation, this procedure is applied in the following three ways. In
each case, the constant n is dependent upon the accuracy to which we know x.
1. The first application is used to identiSl a sum of powers of a given transcendental
number. For each member < in a list of selected transcendental numbers, we
attempt to construct an integer relation for the vector [z, 5, pl, pz, . . . , plT.
2. The second is used to identiSi a surn of various constants. For al1 subsets of
size n from a selected set of constants {cl, c2, - . . , h), we attempt to construct
an integer relation for the vector [z, el, ci,, . . . , &,lT. To avoid combinatorid
explosion, the constant m should not be too large.
3. The third method of application is used to identiG a product of various con-
stants. For d l subsets of size n from a preselected set of positive constants
{kl, k2,. . . , km), we attempt to construct an integer relation for the vector
[log I T ~ , log(ki1 ) , log(ki2), . . . , log(ki,)lT. If [-ao, al, . . . , onIT i~ found to be a
suitabte integer relation, then we claim 1x1 is the value n;=, (ki,)qlaO. It is
useful in this case for some of the constants ki to be small primes.
This procedure is also used in conjunction with the method given in section 3.1.4 to
identi@ expressions involving functions of certain constants.
It shorild be noted that with an appropriate choice of constants, this procedure
can be used to identify simple expressions involving both sums and products. If the
constants cl, c*, . . . C, involve products or the constants kl, k2,. . . , kn involve sums,
then the resulting expressions may involve bot h sums and products.
Appendix A
Integer Relation Algorithms
(Maple Code)
A.l The LLL Algorithm
The following is a Maple implementation of the LLL algorithm and corresponding
integer relation algorithm as outlined in section 2.1. For a selection of improvements
to the basic algorithm given
LU := proc(L1 l o c a l n. N. i. j. k. Ku, q. B. B2.
n := nops(L1; N := nops(L (11 I ; B : = a r r a y ( l .. n. 1 .. NI; 82 := j r ray(1 . . n, 1 . . NI; PB2 := ar ray(1 .. nl; Mu := array(1 .. n! 1 .. NI; f o r i t o n do f o r J t o N do
BCi, jl := LCii C j l ; if i = j then MUCL. jl
od od :
here, one is referred to [7].
nB2. v l , v2. nvl. nv2. m. W;
f o r i t o n do VI := [saq(B[i, a, k = 1 .. NI]; f o r j t o 1 - 1 do
v2 := Cseq(B2Cj. id . k = 1 - - NI1 ; Mu C i , j] := inner(v1. v2) / inner(v2, v2) ; f o r k t o N do 71w : = v l C k j - h t i . j l r v 2 0 t l od
od ; f o r k t o N do 82[i, kl := viCkI od; nB2CiJ := inner(v1. v l )
od; k := 2;
while k c n + 1 do for j f r o ~ k - 1 by -1 t o 1 do
:= round(KuCk, jl! ; Si q <> 0 then f o r 1 t o N do
B k , il := BCk. il - q*B[ j , il:
APPENDLX A. INTEGER RELATIOIV ACGORITHMS (MAPLE CODE) 54
h [ k , il := HuOr. il - q*HuCj. il od
f i od ;
if (3/4 - Hub, k - 1]-2)rPB213c - 13 <= p ~ 2 N th- k : = k + l
e l se f o r i t o N do
tmp := BCk. il: ; B k . il := B k - 1, il; B k - 1, il := tmp
od; fo r i t o N do
vlCi] := B 2 k . i] + Ku&. k - I ] * B ~ & - 1, il od; nv1 := PB2W + Mub. k - 11'2.PB2b - 11; m := i4ukir, k - lIfaB2B - l]/nvl; f o r i t o N do v2Cxl := B 2 b - 1, il - rn*vifil od; nv2 : = nB2 Ocl en82 k - 11 /ml : fo r i t o k - 2 do
tmp := KuB. i3; Hu&, il := i4uB - 1, il; H u b - 1. il := tmp
od; fo r i from k + 1 t o a do
tmp := haCi. k l ;
od ; liutk. k - 11 := m; fo r i t o N do
B2Ck - 1. il := vlci] ; B2B, i] := v2Li1 od :
od ; ElEïüRN([seq([ssq(B[i. j] , j = 1 . . NI], i = 1 . . n)])
end ;
intRel := proc(x) local i, j , B. 82. n;
n := nops(x) ; B := array(1 .. n + 1 , 1 .. n); fo r i t o n do f o r j t o n do
if i = j then B C i , j] := 1 e l se Bci, j] := O f i od
od ; for i t o n do B[n + 1 , i] := 10'~igits*x[i l od; E2 := ILL( [seq([seq(B[i, j], i = 1 .. n + l)], j = 1 . AETURHC CseqCB2Cll C i l , i = 1 . - d l 1
end ;
ECO. O. 11. C-1. O. 03, CO. 2. 013
> Digits : =10 : > intRel( [11.27.31] 1 ;
C l . -S. 41
APPENDLX A-
A.2 The
IIVTEGER REL-4TION ALGORITHMS (MAPLE CODE) 55
HJLS Algorithm with Full Reductions
The following is a Maple implementation of the HJLS algorithm with full reductions
as outlined in section 2.3.1.
tiJLS := proc(x) l o c a l A . B. M. r 2 . n, a. j , k , i i , t . r. manu, marmr2, anorm,
aipha, beta. lambda. de l t a . Id , W. v l . v2. ho. t o l ; n := nops(x); A := array(1 . . n. 1 . . n); B := array(1 .. n. 1 .. a); K := array(1 .. n. 1 .. n) ; v l := array(1 . . n) ; v2 := array(1 .. n); ho := x/ iva i f ( sq r t< iPner (x , XI)) ; r 2 := Cseq(evaif(sqrt(2) ' i) . i = 1 . . n - 111; t o l := mu(floor(9/10*Digi ts) . D i g i t s - 4) ; f o r i t o n do f o r t o n do
it i = j t i e n A[i, j J := 1; B C i . j] := 1; U C i . j] := i
e l s e &Ci. JI := 0; BCi, jI := O; M C i , jl := O f i
od od; MCn, n] := 0; f o r j t o n - 1 do
v1 := Cseq<KCi. 21, i = 1 .. d l ; f o r k from O t o J - 1 da
i f k = O then v2 := ho c l s e v2 := [seq(M[i, k], i = 1 .. n)] f i ; v l := v l - inner(v1, v2)*v2
od ; v l := v ~ / s q r t ( i n n e r ( v l . v l ) ) ; f o r i from j t o n do U r i , j] := vlCi] od
od ; f o r i from 2 t o n do f o r j from i - 1 by -1 t o 1 do
i f M C j , jl < 2*abs(HCi. j l ) then t := round(Ni , jlfiij, j l l ; f o r k t o n do
M C i . kI := Uri , k l - t*MCj. a; A C i . kl := ACL, kl - t*ACj, LI ; BEIF, jl := BCk. jl + r*BCk, il
od f i
od ad; 2 := 1; maxm := M [ 1 . 11 ; maxmr2 := r2[ll*MCl, 11; f o r i from 2 t o n - 1 do
i f maxm c M C i , i l then maxm := K C i . il f i ; t := r2CiJ*UCi, il; i f -2 <= t then m 2 = t ; r := i f a
od ; anorm := 1 ; u h i l e IO'(-tol) < abs(MCn. n - l]/anorm) o r r C> n - 1 do
alpha := M C r . r ] ; beta := U C r + 1. r l ; lambda := U [ r + 1. r + 11; d e l t a := sqr t (bs ta -2 + lambàa-2); Id := l a m b d d d s l t a ; W := b e t a / d e l t a ; f o r k t o n do
t := A h , k l : A C r . W := A C r + 1, W ; &Cr + 1. kl := t ; t := BCk, rl; BCk. rl := BCk, r + 11; B[k, r + 11 := t ; t := MCr. k l ; M k . ICI := M C r + 1, kJ; M[r + 1, kl := t
APPENDIX -4. INTEGER RELATION ALGOWTHMS (MAPLE CODE) 56
HZ;, r] := d e l t a ; M [ r , r + 17 := O; X[r + 1. r] := alpha*bd: H[r + 1. r- + 11 : alpha*ld; f o r k from r + 2 t o n do
;(g: : p ; = = g * t + id*MB, r + 11; MD, r + 11 := id*t - b & k , r + 11
od ; f o r i f r o m r + 1 t o LI do
if = r t 1 than ii := r e l s e ii := r + 1 f i ; f o r j f r o n a i by -1 t o 1 do
if n[ j , j] < 2*abs(Pf[i, j l ) then t := round(KCi, j l f l c j , jl); f o r k t o n do
MCi, kl := UCi, kl - t*HCj, kJ; A c i s kl := A C i . kl - t * A C j , W; B&, j] := B[L. jl + t*BCk, ii
od f i
od
r := 1 ; maxm := U C l . 11 ; -2 := r2tiI*MCl, 11; f o r i from 2 t o n - 1 do
i f man^ < nCi. il then maxa := H C i . il f i ; t := r2Cil*MCiS i l ; i f mrrmr2 <= t then -2 := t; r := i f i
od od ; RETr(N(Cseq(B[i, n - 11, i = 1 - -
end ;
A.3 The Basic PSLQ Algorithm
The following is a Maple implementation of the basic PSLQ algorithm as outlined in
section 2.4.1. Improved practical algorithms are presented in the next two sections.
y'" := proc(x, Tl o c d n , 3, H, y, i. j, k. ganma. C. CH. -y, min
t. r. t e q , aïpha. beta. ~ a n d ~ . d e l t a . M. E: ='&: v; eps := evalf(l0'&(-f l o o r ( 9 / 1 0 * ~ i g i t s ) . -Digits + 4) ) ; n := nops(x); gamma := aval f (sqrt(4/3)) + IO'<-Digits + 1) ; B := array(1 . . II. 1 . . n); f o r j t o n do f o r k t o n d o
i f j = k t h e n B b . kl := 1 e l s e BCj, kl : = O f i od
od; A := array(1 .. n, 1 . - n - 1 ) ; s := array(1 .. n) ;
APPENDJX A. INTEGER RELATION ACGORITHMS (MAPLE CODE) 57
f o r k t o n do s&l := evalf (sqrt(sumCxCjj1-2. jj = k .. n ) ) )
od ; f o r i t o n do
fo r j from i + 1 t a n - 1 do HCi. jl := O od; if i <= n - 1 t h e n HCi. il := sCi + i]/s[i] f i ; f o r j t o i - 1 do
H[i, j] := evalfc- x[i]*xCjl/<s(j]*sCj + 11)) od
od; := evalf (x/s C l ] 1 ;
$or i fro. 2 t o n do f o r j from i - 1 by -1 r o 1 do i f K[j, jl < 2*absCHCi, j]) tban
t := r o d ( H C i . jI/HCj. j l ) ; yCj1 := y 9 1 + t*yCil ; f o r k t o J do Hci. := HCi, k] - t*HCj, k] od; f o r k t o n do Bb, j] := B k . j] + t*B&, il od
f i od
od ; G := array(1 .. n - L!; cc11 := m; CH := array(1 . . n - 1); GHC11 := HC1. I I ; f o r i from 2 t o n - 1 do
G C i ] := C r i - l! *-; G H i i l := G C i l *HCi. i]
u h i l e eps < miny and l/maxHii < T do r := 1; f o r i from 2 t o n - 1 do
i f CHCr] < GHCil then r := i f i od ; tcmp := yCr1; yCr1 := yCr + 11; yCr + 11 := temp; f o r i t o n - 1 do
teup := B C i . rl; B C i , r] := B [ i . r + 13; B l i n r + 11 := te-; temp := HCr, i l ; H C r . il := H [ r + 1, i l ; HCr * 1. il := temp
O d ; teap := BCn. r ] ; Brn. r] := BCn, r + 11; B[n, r + 11 := tcmp; i f r < n - 1 t h e n
alpha := HCr + 1. r l ; beta := H C r . ri; lambàa := HCr. r + 11; d e l t a := sqrt (beta-2 + lambda-2) ; bd := be ta /de l t a ; I d := lanbda/del ta ; HCr. r] := d e l t a ; RCr, r + 13 := O; H Cr + 1. r] : = alpha*bd ; H[r + 1. r + 11 := - alphaeld; for i from r + 2 t o n do
od ; GHCr + 11 := GCr + l]*abs(H[r + 1 , r + 11)
f i ; GEiCrl := G[r]*abs(HCr, rl); f o r i from r + 1 t o n d o f o r j f rommin( i - 1, r + 1)
by -1 t o 1 do i f abs<H[j. j l l < 2*abs(HCi, j ] ) then
t := tound(HCi, j l /KCj, j l ) ; f o r k t o J do
H[i, U := HCi, - t*HCj, k] od ; f o r k t o n do
Eh. jl := B k , j] + t*B[k, il
00 ; -y := abs(yC11); mlnyp := 1; f o r i from 2 t o n do
APPENDrX A. iNTEGER RELATION ALGOMTHMS (ALWLE CODE)
od ; v := Cseq(BCi, minypl. i = 1 .. n)]; &y := enif(miny/sqrt(inner(v. v) ) ) ; &fi := abs(HC1. 11); for i from 2 t o n - 1 do
if marEii < abs(HCi, iJ) then &ii = abs(H[i. il)
f i od
od ; if eps < miny then RETI3RW( 'Louer Bound: ' ,
evalf Cl/maxfiii. &(Digits, 6) 1) e lse RETü?W( CssqCB Ci. minypl , i = 1 . . a)] fi
end ;
A.4 The PSLQ Algorithm with Periodic Full Re-
duct ions
The folionring is a Maple implementation of the PSLQ algorithm with periodic full
reductions as outlined in section 2.4.2.
y19 := proc(x, T) o c a l n B H i . j , k . g a m n a , C . G H . m i n m i n m a x H i i , s . t , r ,
t&p: a.&. bosa. lambda. delta. M. 1;. a.?: eps. v. doFuilRed; eps := evalf (lO'Mn(-f loor(9/10*3lgits) . -Digits + 4) 1 ; n := nops(x) ; gamma := evalf (sqrt (4/3) + IO'(-Digits + 1) ; B := a n a y ( 1 .. n, 1 .. n); for j t o n do f o r k +O n do
if j = k then Bk. k3 := 1 e lse BCj, Ic] := O f i od
od ;
APPENDnr A. INTEGER RELATION -4LGORITHMS (MAPLE CODE) 59
K : = a r r a y ( l .. n. 1 .. n - 1); s := a r r a y ( 1 .. n ) ; f o r k t o n do
SIXI := avalf(sqrt(sum(xCjj]-2, jj = k .. n) ) ) od; f o r i t o n do
f o r j from i + 1 t o n - 1 do HCi. jl : = O od; i f i <= n - 1 then H[i. il := sCi + l]/s[i] f i ; f o r j t o i - 1 do
BCi, jl := s v a î f ( - xCil*x[j]/(sCj]*sCj + 11)) od
od ; y := ava ï f (x/s C l ] ) ; f o r i from 2 t o P do f o r j from i - 1 by -1 +O L do
if H[j, j] < 2*abs(H[i, j]) t h u r t := round(H[i, j]/HCj, j ] ) ; yCj3 := yCj1 + tvtil; f o r k t o 3 do HCi . := H C i . Itl - t*HCj, k7 od; f o r k t o n do B k . j] := B r i , j] + t*B(k. il od
f i od
ad; G := -y(l .. n - 11; CC11 := g-; CH := array(1 . . n - 1 ) ; GHClJ := HC1. 13; f o r 1 from 2 t o a - 1 do
G C i l := G C i - l]*g.inina; GHCi] := G[i]*H[i. il od ; -&;=:&
vhi le aps < miny and l f d i i C T do doFullRad := f a i r e ; v h i l e not doFriLlRad do
r := 1; f o r i from 2 t o n - 1 do
i f GFI[r] < CH[i] thao r := i f i od; if abs(H[r, r] 1 < 2*abs(HCr + 1. rl 1 then
t := round(HCr + 1. r]/HEr, r l ) ; yCrl := yCr1 + t*yCr + 11; f o r j CO r do
H [ r + 1. j] := Bfr + 1. j] - t*BCr, j] od ; f o r j t o n do
B C j . rl := BCj, r] + t*BCj, r + 11 a;.
od A L *
temp := ver]; yCrl := y[r + 1 7 ; yCr + 11 := tamp; f o r i to-n - 1 do
tom? := B C i . rl ; B C i , rl := B C i , r + I l ; BCi, r + 11 := t e p ; tcmp := HEr, i l ; H C r , il := R C r + 1. i l ; H[r + 1. il := temp
od :
alpha := H C ~ - + 1. r f ; beta := H C r . r ] ; lambda := H C r , r + 11; d e l t a := sqrtcbeta-2 + lambda-2); bd := ba ta /dc l ta ; Id := lambda/deita; HCr. r] := d e l t a ; H C r , r + 11 := 0; H[r + 1, r] := alpharbd; IfCr + 1, r + 1) := - alpha*ld; f o r i from r + 2 t o n do
a := Hli . r l ; b := H [ i , r + I I ; H C i . rl := a*bâ + b*ld; H C i , r + 11 := b*M - a*ld
ad; CHCr + 11 := G C r + ll*abs(HCr + 1, r + 11)
e l s s doFulïRed := t r u e f i ; GH Cr1 : = G Cr1 *abs <H C r . rl 1
.4PPENDLX A. IIVTEGER RELATION ALGORITHMS (MAPLE CODE) 60
ad; f o r i from 2 t o n do f o r j from i - 1 by -1 t o 1 do
i f H C j , jl C 2*abs(H[i, j]) then t := round(H[i, j]/ü[j, j ] ) ; yCj1 := yCjl + t*yCil; f o r k t a 3 do
Bf i , k] := B[i, kl - t*H[j, k] od ; f o r k t o n do
BCk. j 7 := B k . j l + t*Bik. il od
fi od
O$; -y := abs(yC11); lulyp := 1 ; f o r 1 from 2 t o n do
if abs(yCi1) < miny then mipy := abs(yCi1); minyp := i
fi od; v := [seq(B[i. minyp]. f = 1 .. n)]; mîny := evaif(miny/sqrt<ianer(v, VI)); mii := abs(EiC1. 11); f o r i from 2 t o n - 1 do
i f Wii < abs (FiCi, il then muHi i = abs(HCi, il)
f i od
od ; i f eps < miny thsn REfmLN( 'Lover Boaad: ' ,
evalf(l/maxHii. -(Digits, 6 ) ) ) e l s e REïüRN(Cseq(B[i, miPyp], i = 1 .. n ) l ) f i
end ;
A.5 A Multi-Level implementation of PSLQ
The following is a multi-level implementation of the PSLQ algorithm as outlined in - -
section 2.4.3. The matrices A 2 , B2, and H2 correspond to the matrices A, B and Hi and y2 corresponds to the vector 7. The matrices 8 3 and H3 are used only to store
intermediate results while updating the matrices B and H. The rnatrix Bs is a low
precision, scaled copy of B that is used to help determine if an integer relation has
been detected inside the procedure pslqhf.
:= proc(vect : : l is t , T) s x y B H n i j k Min, M n c o l , maxH,
-ii. 'o. 't, *12: B;, ~ 2 . ' 8 - r ' H3. 572. minypo~, miny, D, eps, t o l . hdig, d i m . x l m . B s , Bmax, v;
hdig := evalbf (Digits) ; alim := h d î g - 2; D := Digats, n := nops(vect1; t o l := min(-f loor(9/lO*D), -D + 4) ; eps := evaïf (10-tol) ; X := e v d f (vect/sqrt(sum(vect [il-2, i = 1 . . d l ) ; ganma := svaïf (sqrt(4/3) , 16) + 10-(-15) ; s := array(1 . . n); H := ar rayc l .. n. 1 .. n - 1) ; B := arrayCl . . n. I . . a); y := array(I .. n) ;
APPENDIX A. INTEGER RELATION ALGORITHMS (M-4PLE CODE) 61
G := array(1 .. n - 1 ) ; KI2 := hfarray(1 . . n, 1 .- n); 82 := hfarzay(1 . . n. 1 . . n) ; y2 := hfarz-ay<l . . n); H2 := hfar ray<l .. n. 1 . . n - 1); H3 := arraycl . . n, 1 . . n - 1) ; 53 := array(1 . . ne 1 . . n); Bs := hfarray(1 -. E. 1 .. n); cc11 := gaama; f o r i f roa 2 t o n - 1 do Cri] := G [ i - l I * q od; f o r i t o n do yCil := X C i l od; scd := y[p1-2; f o r i from n - 1 by -1 t o 1 do sri] := s[i + 11 + yCil-2 od; s := evaïf(map<sqrf. a ) ) ; f o r i t o n do f o r t o n - 1 do
j < i d e n R C i , j l := - y ~ i l * y C j l / C s [ j l * s ~ j + 11)
e l i f j = i thon H [ i , J I := sCi + ll/sCil else HCi, jl := O f i
od od; f o r i t o n do f o r j t o a do
i f i = j thon BCi, j] := 1; B s C i . jl := 1 e l s e B[i, jl := O ; B s C i . j] := O f i
od od ; Bmax := 1.; i f hdig < D i its then f o r i from 2 t o n do f o r j from
i - f by -1 t o 1 do i f abs(H[j. j]) < 2*abs(B[i. j]) thon
t := rouad(H[i, jl/HCj, jll ; f o r k to J do
H [ i . := H C i , kl - t*HCj. kl od; f o r k t o n do
B[k. j] := B[k, jl + t*B[k. il od; yCj1 := y l j l + t*yCil
f i od
a: - ad A L ,
f o r i t o n do f o r j to n - 1 do H2Ci. j l maxH := O ; Uin := abs(yC11); f o r i from 2 t o n do
i f abs(y[i]) < Min then U i n := abs(y i f marH < abs(H[i - 1 , i - 11) then
maxH := abs(8Ci - 1 , i - 11) fi
od ;
:= H C i .
.Cil) f i ;
vhi le eps < Hia and l/maxH < T do miny := abs(yCl1 1 ; f o r i t o r do
for j to n do i f i = j then BZci, j] := 1; A2Ci. jl := 1 else B2Ci. j] := O; A2[i, j l := O f i
od; i f abs(y C i ] ) < miny then &y := abs(yCi1) f i
od ; miny := e v a l f (miny , 18) ; f o r i t o n do y2Ci'J := evaïf (y [il , 18)/MPy od; xlim := min(-1. mu(-hdig + 2. t o l - op(2, miny)
- length(op(1. miny)) + op(2, Bnrax) + length(op(1, h))));
i f hdig < D then for i t o n do
v := [seq(B[i, k]. k = 1 .. d l ;
APPENDIX A. INTEGER RELATION ALGORITHMS (MAPLE CODE) 62
od; f o r
od; f o r
od;
f o r j t o n do 03Ci. jl := i nne r (v . Cseq(B2Ck. jl. k = 1 .. d l )
od
i t o n d o f o r j t o n do BCi, jl := B3Ci. jl od
i t o n do y[i] := h n a r C X , Cseq(BB, i l . k = 1 .. n ) l l
m+y : = abs (yC1l) ; mrnypos := 1; f o r i from 2 t o n do
i f abs(y C i l ) < miny t hen miny := abs(y[ i ] ) ; minypos := i
fi od; v := [saq(B[i. minypos], i = 1 .. 1111: Min := a v a l f ( ~ y / s q r t ( i n n e r ( v , v) ) )
rlse - - -
f o r i t o n do y [il := yîCi1 ; f o r j t o n do B[i. j] := B2[i, j] od
O?; H m := O
f i ; if eps < Min t h e n maxa := O;
f o r i t o n do v := Cseq(A2Ci, kl. k = 1 .. nl l ; f o r j t o n - 1 do
H3fi. jl := i n n e r ( v , Cseq<Bk. jl. k = 1 .. n ) J > ;
if maxH C abs(H31i. jl) t h e n mamH := abs(H3Ci. jl)
f i od
od; muH := e w a l f ( m a x H ~ 1 8 ) ; for i t o n do f o r J t o n - 1 do
Hci , jl := H3Ci. jl; =Ci, JI := e v a i f ( H 3 C i . j 3 , 18)/madI
od od ; evalhf (myU (H2, n) 1 ; &ii := absCH2Cl. 11); f o r i t o n - 1 do
if marHiq- C abs (H2 C i . i l ) then -11 := abs(H2Ci, i l)
f i od; maxR := & a i e ; Bmax := O ; f o r i t o n do f o r j t o n do
if Bmax C abs(BCi, j ] ) t h e n Bmax := abs(B[i , j ] )
f i od
f i od;
i f T <=
od; Bmzu := evalf CBmaxSA f o r i t o n do f o r J
BsCi, j] := od
od
1 /maxfi t hen RETURN('Lower Bound: ',
f i ; H+t := a b s ( y t l 1 ) ; mlncol := 1; f o r j from 2 t o n do
i f abs(yCj1) C !fin t h e n f i
18) ; t o n do e v a ï f (B C i . j] , 18)/Bmu
od : REïüRN( Cseq(round(BCi. mincol! 1, i = 1 . . d l
end ;
APPENDIX A. INTEGER RELATION .4LGORITHMS (MAPLE CODE)
myLQ := proc@, n) l o c a l 1,- j . k. a. b. c , t. aa;
f o r 1 t o n - 1 do aa := B[ i . i l - 2 ; f o r j from i + 1 t o n - 1 do
i f B C i , j] <> O then b := BCi. jl; aa := aa + b'2; C := S Q L ~ <MI ; a := BEI, i I / c ; b := b/c; BCi. il := c ; B C i . j] := O ; f o r k from i + 1 t o n do
t :s 3Dr. i l ; B&, 11 := a s t + b*BCk, jl; ~ b . j] := - b*t + a*BCk. jl
od f i
pslqhf := proc(H. A. B. y , +m. +m. n. C. E s ) ocal i, j. k. gamna, CH, run PILICJ(, S . t. r. t
alpha. ?ta. Iambâa. da~&-$*ld. a. b. .pi . d o ~ 8 k d ; eps := 10 xhm; f o r i from 2 t o n do f o r j from i - 1 by -1 t o 1 do
i f H t j . j3 < 2*abs(H[i, j l ) than t := rorrad(HCi, jl/HCj, j l ) ; yCj1 := y t j l + t*yCil; f o r k t o J do H C i , kl := H C i . hJ - t*HCj. iJ od; f o r k t o n do
A C i . kl := A C i . - t*ACj. kl; B k , jl := B k , j] + t*BCk. il ; B s k . J I := Br&, j] + t*Bs&, il
od f i
od od ; CH := ar ray(1 .. n - 1 ) ; f o r i t o n - 1 do CHCil := GCi]*H[i, il od; b y := 1; narA := 1;
u h i l e eps < miny and maxA < 10'ali.m do doFulïRed := f a ï s a ; v h i l a not doFu1ULed d o
r := 1; f o r i f r o p 2 t n n - 1 do
i f GHCr] < CHCi] than r := i f i od ; i f abs (H [r , r] ) < 2+abs(HCr + 1, r] ) then
t := round(HCr + 1. r ] / H [ r . r l ) ; y[r] := yfk] + t*yCr + 11; for
od ; for
od fi;
tcmp : = A C r , il; Afr, il : = A C r + I . il; A C r + l , il := temp; c a p := BCi, rl; B E i . rl := B C i , r + 17; B C i , r + 11 := tamp; tamp := BsLi. rl; B s C i . rl := BsCi, r + 11; B s C i . r + 11 := tamp; tamp := HCr, il; HCr, il := H C r + 1, il; BCr + 1, il := temp
APPENDM A. INTEGER RELATION ALGORITHMS (MAPLE CODE)
temp : = A C r . nl; A C r , n l : = A [ r + 1 , d; A C r + l . ILI :=tamp; if r < a - 1 Zhen
aipha := HCr + 1. rl; beta := HCr. rl; lanbàa : = H Cr, r + 17 ; d e l t a := sqrt (beta-2 + lambda-2) ; M := beta/del ta ; Id := lambàa/delta; H C r , r] := de l ta ; H C r , r + 11 := O; ECr + 1, rl := alpha*-; H C r + 1. r + 11 := - alpha*ld ; f o r i f r o n r + 2 t o n do
a := HCi, r]; b := H[i, r + 11; E[i. ri := a*W + b*ld; H C i . r + 11 := b*bd - a*ld
od ; CHCr + 13 := G C r + l~*abs(!iCr + 1. r + 11)
e l s e
--
f i ; GH[r] := GCrl*abs(HCr. r])
od ; f o r i from 2 t o n do f o r j from i - 1 by -1 t o 1 do
i f H C j , jl < l*abs<HCi. j l ) then t := roundQCi, j l / H C j , j l l ; yCj1 := yCj1 + t * y l i l ; f o r k t o J do
Hfi . Id := H C i , kl - t*H[j. k] od : f& k t o n d o
A C i , kl := A C i . kl - t*ACj, k l ; BB. jl := B k . jl + t*Btk. il; BsB. 11 := B s k , jl + t*BsCk, il
od f i
od od; +ny := abs(yCl1); minyp := 1 ; f o r i from 2 t o n do
i f abs(yCi1) < miny then miny := abs<yCil); Mnpp := i
f i od ; s := O ; f o r i t o n do s := s + B s C i . minypl-2 od; miny := miny/sqrt (s) ; maxA := absCACI, 1 1 ) ; f o r i t o n do f o r 3 t o n do
i f maxA < abs(A[i. j] t h e n
A!z IMXA := abs(ACi. j l ) x 1 od
od od
end ;
Appendix B
Recognizing numerical constants
(Maple Code)
B. 1 The Reverse Engineering Calculat or
The following Maple code is an implementation of the procedures outlined in chapter 3. The code presented here is the Maple portion of the Reverse Engineering Calculator
(RevEng) available on line at
It should be noted that a modified version of the rnultilevel PSLQ algorithni is used in
these procedures. The version used no longer requires a bound T to be passed to the
algorithm as it calculates one internally based on the level of precision and number
of elements in x. If at some stage the algorithm determines that no integer relation
exists with norm less than T, then the modified version r e t m the current vector bi
with the property that xTbi is minimal.
The following global variables are used within these procedures:
maxErr: This is the maximum error we allow in a recovered expression for the
input. It is measured in units of the Iast place (ulp7s).
APPENDar B. RECOGNIZING .VUMEREU C O N S ? ' ' (1UPLE CODE) 66
o funcs, REVval, XEVpi: jüncs is a list of functions and their ranges. Each
function must be in Maplets inufunc array which can easily be extended. The
variables BEVval and XEVpi are used internalIy by fzmcs. To avoid special
coding, both a function and its inverse should appear consecutively
BI : This is a list of transcendentai numbers. It is used to identi6 sums of
powers of a transcendental number as described in section 3.2 (1).
B2: This is a list of constants. It is used to identie sums of constants as
described in section 3.2 (2).
0 B3: This is a list of constants. It is used to identi& products of constants as
described in section 3.2 (3).
The default values for these globd variables are as foilows: madkr := IO;
funcs := C [sin, -l<=,REVval and RNvaï<=l]. [arcsin, -,~~~tlpî/2<=,FlËVval and ,REVvai<=,REVpi/2] . [cos , -l<=,REVval and ,REVvaï<=i3 , Carccos. O<=-REYval aad ,REVvaï<=,REVpil, ta^, f . [arctan. -,REVpi/2<,REYvai and ,REVvai<,REVpi/2] , [csc. ,REVvd<=-1 or l<=-REVval] , Carccsc , -,REVpî/2<=-REVval and ,REVvai<=-REVpi/2 and ,REVval<>O] . [sec, ,REVval<=-1 or lc=,REVvall, Carcsec. O<=-REVval and ,REVval<=,REVpi and ,REVvalo ,REVpi/2 ] , k o t , truel , [arccot . O<,REVval and ,REYvai<,REVpi] , [sïnh. +rua] , Cucsinh, t ~ e I , Ccosh. I<,RFYvall. Carcc03h, 0~=-REVvail. Ctanb. -1C-REVval and ,RëVvai<ll. [arctaph, true] . [csch, ,REVval<>O] . [arccscb REVval<>O] . [sech, O<,REüval and ,REvval&i] , [arcsech, O<=,REVvall. Ccoth . ,REVval<-1 or lc,REVval] , Carccotb, ,REVpalC>Ol, [exp. O<,RRTvall , [ln. truel . CLambtrtY, O<-REVvall 1 ;
B. 1.1 Recognizing rational values and functions of rational
values
The following code is used for recognizing rational values and functions of rational
values. It follows the procedures outlined in sections 3.1.1 and 3.1.4.
APPENDDC B. RECOGNIZIhTG NUMERICAL CONSTA-?'S (AL4PLE CODE) 67
israt := proc Cf: :f loa t ) l oca l S. t o l ;
s : = i s r a t ional (f ) ; t o l := l . ~ * l O ' o p ( 2 . f); if sF23 <= t o l than RFTffRA(car(
Input matches t he f ollovang rat ional: ' . convert<s C l ] , s t r ing) , ' . ' 1) e l se RETJXN(gFAIL') f i
and ;
i s ra t ional := proc(f::float) l oca l aïpha. a. p. q, conv, d i f f , k. j. lan. Col. d l . disagrea;
Ien := max(length(op(1. f ) ) . abs(op(2. f ) ) ) ; Digits := len + 5; f o l := .5*10-op(2. f ) ; a := ~ f l o o r ( f i f f - a111 = 0'than FLETüRN(aC11. 0 ) e l se alpha := l / ( f - dl]) a;. &A,
a := Cop(a). f loor(aïpha)l ; i f alpha - a121 0 O then alpha := l/(alpha - aC21) f i ; p := hCi3 . aCl3 *aC2l + 11 ; q := Cl, aC213; conv : = Cp Cl1 . pC21 /qC2ll; d i f f := [abs(f - convCl]), abs<f - convC2I)l; k := 2:
k := k + 1; a := [op(a>. f loor(alpha)l ; iif aipha - a w <> O then alpha := l/(alpha - a&] a-. xr; P := Cop(p). aCI7*pDr - 13 + p i 3 - 211; q := Cop<q), a M * q b - II + qCk - 213; conv := Cop(c0nv). p Ckl/qrsd~ ;
. diff := Eop<diff). absCf - convkl ) ]
end ;
funct ionofht := roc(f::float) l o s a i len. F, G, Era,nse. inrange. Fdomain. indomain. n. f2. a s . r a t l i s t . t o l . d i f f ; global ,REVvai. ,REVpa, funcs;
l en := length(op(1. f ) ) ; Digits := -(S. len) ; t o l := l.tmazErr*lO-op(2. f); ,REVpi := evalf (Pi) ; r a t l i s t := 0; f o r n to nops(funcs) do
F := funcs Cnl Cl1 ; Frange := f uncs Cd [2] ; i f F = LambertW then Fdomain := t rue e l i f n mod.2 = O then Fdomain := funcs [n - 11 C21 else Fdomaln : = f uncs Cn + 11 C21 - -
f i ; ,REVvai := f ; +ronge := evai(parss(Frange) 1 ; i f =ange then
C :=-ïnvfuncCF3; f2 := Ralevalf (C(f))); if f 2 = O then ans := [O, 01 else ans := i s ra t ional ( f2) f i ;
ans <> 'FAIL' then ,REVval : = ans C l ] ; indonain : = aval (parse (Fdomain) ; i f indoaiairi then
dif f := abs (evalf (FCans [Il - f 1 : i f d i f f <= t o l t h e n - r a ~ l f s t :=
[op(ra t l i s t ) . c a t ( . conoert(F, s t r i ng ) , '( ', conver+(ansC13, string). ' ) ' I l
fi
RECOG-MZING NuVMERiCAL CONSTMTS (MAPLE CODE) 69
nestedR := proc(poly, val) 1 0 c d i, f , cf , a. b, c, s r , roots, A , B. C, sgn, deg, value. d i f f , c loses t , cval. cd i f , len. s ize ;
deg := dagrae<poly, -1); f := poly/coef f (poly, -1, deg) ; fo r i from O t o deg do cf C i ] := coef f Cf. ,X, i l od; a := - cf [dtg - 11 /deg; A := convert (a. s t r ing) ; b := 0 ; c := O; if deg = 2 then
b := a-2 - cf CO]; B := convert (b , s t r ing) ; roofs := Ccat<A, ' + sq r t ( '. B. ' 1').
cat(A, ' - sq r t ( ', B, ' ) ' I l e l i f deg = 3 th-
i f 3*ae2 = cf [II than b := -ad3 - cf COI ; if 0 < b th?n
s p : = + ' ; B := convert Cb. string) else sgn := ' - ' ; B := conveflC-b. string) f i ; roots := CcatCA, sgn. '( ', B , ' )"<1/3)')]
f i e l i f deg = 4 *en
i f 6*a-2 = cf 121 and -4*a'3 = cf C l ] then b := a'4 - cf COI; B := convert(b. s tr ing) ; roots := [cat(A. ' + ( :, B, ' )'<1/4Ic)
cat(A, ' - ( , B. ) - (1 /4)9j else
b := 3*a-2 - 1/2*cf [Z] ; i f 4*a* (b - a-2) = cf C l ] then
c := Ca-2 - b)-2 - cf COI ; sr := sqrt(b-2 - C) ; if t y p e b r , rational) then
c := 1/2*b - l/S*sr; b := 1/2*b + 1/2*sr; B := convert (b. s t r ing) ; C := convert(c. s tr ing) ; roots := Ccat(A, ' + sq r t ( :. 0, ' ) + sq r t ( '. C, ' )').
cat(A. ' + sq r t ( . B, ' ) - s q r t ( '. C. ' )'), ca+(A. ' - s q r t < ' , B. ' 1 + s q n ( '. C. ' )'). cat(A. ' - sq r t ( ' B , ' 1 -sqrt< '. C. ' 1'11
e l s e B := convert(b, s tr ing) ; C := convert(c. s t r ing) ; roots := Ccaz(A. ' + s q r t ( : , 0, ' + s q e < ', C. ' )').
cattA. ' + sq r t ( . B. ' - s q r t < :: E: 1 1'1, cat(A, ' - sq#( '. B. ' + sq r t ( ' ) ) ' > , cat(A, ' - sq r t ( ', B , ' - sq r t ( ', C, ' ) ) * ) ]
f i f i
f i elif deg = 5 then
i f 10*a-2 = cfC3j and -10*ad3 = cf[2] and 5*a-4 = cfcl] then
b := -aa5 - cf [O] ; i f O C b thfn
sgn := + ' ; B := convert (b. string) ~ I S C sw := ' - ' ; B := convert(-b. string) f i ; roots := Ccat(A. sgn. '( ', B, ' 1-(1/5)')1
f i e l i f deg = 6 then
if 15*a-2 = cf [q than i f -20*a-3 = cf [3] and 15*a-4 = cf C21 and -6ra-5 = cf then
b := a'6 - cfC01; F! := convert (b, string) ; roots := [cat(A. ' + ( ', B. ' )-(l/S)').
cat(A, ' - ( ', B, ' 1-(1/6lr)]
REC0GAIVIZIArG NUMERICAL CONSTANTS (AL4PLE CODE) 70
e l s e sgn := ' - ' ; 0 := convert(-b, string) f i ; i f 6*a*b + 15*a'4 = cf 121 and -6*a'2*(b + a-3) = cf C l ] thon
c := (b + a-3)-2 - cf [O]; C := eonvert(c. s t r ing) ; roo t s := CcatCA, sgn. '( ', B. ' + sqrt( ' , C , ' 1 )'(1/3)').
cat<A. s p . '< ', B. ' - s q r t ( ', C , ' 1 )-(1/3)')1 fi
fi else
b := 5*a'2 - 1/3*cf pl ; B := convert(b, strmg) ; if 12*a*b - 20*a-3 = cf C31 rod 15.a-4 - 18*am2*b + 3*b-2 = cf 121 and 12*a^3*b - 6*a*b-2 - 6*a-5 = cf C l ] then
c := (a-2 - b)'3 - cfCO3; i f O < c th?
sgn := + ; C := convert(c, s t r i ng ) e l s o sgn := ' - '; C := convert(-C, s t r i ng ) f i ; r oo t s := Ccat(A. ' + =le< :; B sgn. '( '. C, ' >"(1/3> ) ' ) ,
catch, ' - s q e ( ', C, 1-(1/3) 1'11 e l s e
c := 6*a*b - lO*aa3 - 1/2*cf C31; if cf [2] = 6*a*c - 18*r'2*b + 3*b-2 + 15*a-4 and cf C l ] =
12*a'3*b - 68a.b-2 - 6*ae2*c - 6*b-c - 6*a-5 anci cf [O] = 2*a'3*c - 3*ae4*b - b-3 + 6*a*b*c + c'2 + a-6 + 3*a-2*b-2 then
if O < c t h p sgn := + ' ; C := convert Cc, string)
e l s e SW := c - '; C := convert(-c. s tr ing)
f i ; roots := [cat(A. ' + sqrt( '. B. ' ) '. sgn, ' ( ., C, ' )'(1/3)'),
cat(A, ' - sqrt( ', B. ' ) '. sgn, ( ', C, ' )'(1/3)')] f i
fi f i
fi; i f roots = ' roots ' then REïüRK('FA1L'I f i ; l en := mar(length(op(2, va l ) ) , abs(op(2, val))) ; s u e := map('+', op(map(x -> ' i f C ( x = 0 , O , i f c (
t y p e ( x . in teger) . length(x1. mar(la~gth(opC1. XI), lengzh(op(2, x) ) ) ) ) , Ca. b, cl 1))
i f l i n < 3*sirc then RETüRN('FAILC) f i ; closest := 1; cval := evalf (parse(roots C l ] ) ) ; cdif : = abs (val - cval) ; f o r i from 2 t o nops<roots) do
value : = eval f (parse (roots C i l 1 1 ; diff := abs (va l - value) ; i f diff < cdif than
closest := i; cval := value; cdif := d i f f f i
od ; i f a = O then
i f substring(roots~c1osest~. 3 .. 31 = l'-lD then roots ~ c ~ o s e s t l := substr ing(roots [closest] , 3 . . -1)
else roots Celosest1 := substring~rootsCclosest~ , 5 . . -1)
f i f i ; ~ ( [ r o o t s Cclosesti , cval. cd i f l
end ;
fuxtionofAlg := roccf: :float) loca ï l m . F, C s granp. inrange. Fdomah, indomin, n. f 2 . ans, alg l i sz . t o l . d i f i ; global ,REVval, JEVpx. f uncs ;
l en := length(op(1, f)) ; Digits := max(5, 1-1; t o l := l.rmarErr*lo-op(2, f ) ; ,REVpi := evalf (Pi) ;
APPENDLX B. RECOGNTZZNG NUMERICAL CONSTANTS (MAPLE CODE) 71
a lg l i s t : = Cl ; for n t o nops(funcs) do
F := f uncs [d C l ] ; Frange : = f uncs (n] [2] ; af F - Lambertil then Fdomain := t rue e l i f n P I O ~ 2 = O then Fdomain := funcs [n - 11 [2] else Fdo- := f m c s + 11 [2] f i ; ,REVval : = f ; inrange : = eval (parse (Frange) ; if inrange then
G : = invf rinc El ; f2 := Re<evaïf(G(f))); if f 2 0 O than
ans := isa+ ebraicCf2) ; i f ans 0 $AIL' theo
-REVval : = ans C21; indomain := aval (parse (Fdomdn) ) ; i f indomain then
di f f := abs(avalf(F(ansC2l) - f ) ) ; i f diff C= t o l then
i f typa (ans C l ] , str ing) then blgiise := [op(alglis+) . cat ( ' ', convert(F, s t r ing) . '( ', ansC13, ' 1'11
e l r e a l g l i s t := Cop(alg1ist). cat( ' ' . convert(F, s t r ing ) , ' of the follouing root of ' , convef t<so~(ans Cl1 . str ing) , ' : ' , convert (ans C21. s t r ing) ) 1
f i f i
f i f i
f i f i
od ; i f a l g l i s t = 0 then REITRN('FA1L') else REiüRN(alg1ist) f i
end ;
B -1.3 Recognizing other constants
The following code is used for recognizing other constants. It follows the procedures
outlined in sections 3.2. It should be noted that only the methods of 3.2 (2) and (3)
are used in conjunction with the method of 3.1.4 to identify hinctions of constants.
istrans := proc(f : :f l oa t ) local trans. len, t o l , vect, vectf. m. n. i. j, k , ans. rel,pov, s i r e , re la t ion , d i f f ;
len := maxClength(op(1. f)), abs(op(2. f))); Digits := len; t o l := min(l.+marErr*lO-op(2, f ) , -0001) ; n := min(f loor(l/3*len), 12) ; i f n < 1 then n := 1 f a ; a s := a; for i to nops(B1) do
trans := B I C i l ; if n = 1 then vact := Cl. trans] c l i f n = 2 then vect := Cl. t rans , sqrt(trans)] e l s e
vect := E l . t rans, sqrt( trans1, l /sqrt( trans)] ; pov := -1; f o r j from 4 t o n do
vect := Cop(vect), trans-pou1 ; if O < pou then pou := -pou e l s e pou := -pou + 1 fi
od f i ; vectf := Cf. evalf Cop(vect))l; r e l := pslq(vectf) ;
RECOGNIZLNG hTUMERIC;lL CONST4NTS (M4PLE CODE) 72
i f ral[ i] <> O and silm(abs(re1bJ 1. m = 3 . . nops ( r e l ) ) 0 O then
rel := - x e l / r f l C l ] ; s i ze := map('+ , op(map(x -> ' i f C ( x = 0, O. 'ifc(
type Cx, integer) , length(x). max(langth(op(1. r)). la~gth(op<2, x ) ) ) ) ) . r e l ) ) ) - 1;
i f 3-size <= madlen. 6 ) than r e l a t i on := sum(rel& + ll*vect .
PI = 1 -. nops(veCt)); &if f : = abs (f - evali ( r e l ation) ) ; i f d i f f <= t o l thfncans :=
[opCaru) , cat ( . convert(sort (relat ion). s tr ing) 1 ? f i
f i f i
ad; i f ans = O than UTüW('FA1L') e l se RêïUU(aas) f i
end ;
tryconsts := proc(f : : f l oa t ) loca l s:
s := constants(f); i f s e < > 'FAILc then REIûM(cat(
~ n p u t matches the foïlouing: . convert(s Ctl . s t r ing) 1) else REIiJRN(cFAILc) fi
and;
constants := proc(f : :f l oa t 1 loca l len. vect, n. nv, ind, relat ion, r d , s izs , d i f f , i, j, vect2, t o l ;
len := max(lsagth(op(1. f)). abs(op(2, f ) ) ) ; Digits := len; t o l := l . ~ . l O " o p ( 2 . f ) ; vect := evalf(B2) ; n := min(floor(l/3*len) - 1. 41 ; i f n < 1 then n := 1 f i ; nv := nops(vact) ; i f nv < n then n := nv f i ; ind := u r a y ( 1 .. n); f o r i t o n do ind[i] := i ad; vkile iad[l] <= nv - n + 1 do
vect2 := cf, seq(vectCind[i]], i = 1 . . n)] ; r e l := pslq(vect2); i f re lc l ] <> O then
r e l := - rel/r~l[ll; s i z t := map('+ . op<map(x -> ' i f C ( x = 0. O. 'ifc(
type (x. intager) , length(x). max(length(op(1. x) , length(op(2, XI 1) ) . rd)) ) ;
i f 3ssUa <= l ep then re la t ion := 0; f o r i t o n do relat ion :=
r e l a t i on + relCi + 11 *B2CindCall od ; dif f := abs(f - evalf (relat ion)) ; if d i f f <= t o l then RETmLN([relation. d i f i l ) f i
f i ri; 1 := n; uhile 1 < i and indCi1 = n v - n + i do i := i - 1 od; indCg := +dl i l + Z; f o r 3 from 1 + 1 t o n do indcj] := ind[j - 11 + 1 od
od ; EîüM( 'FAIL')
end ;
functionofConsts := pxoc(f : :f loa t ) loca l len. F, G , Frange. inrange, Fdo-in, indomin, n, 12. ans. poly, C l i s t , t o l , d i f f ; global ,REVval, ,REYpl, fuocs;
len := length(op(1, f ) ) ; Digits := -CS, len) ; t o l := l . ~ * l O ' o p ( 2 , f) ; ,REVpi := evai.f(Pi); Clist := 0 ; fo r n t o nops(funcs) do
F := funcs CrJ Cl1 ; Frange := f iincs C d T21;
APPENDLX B. RECOG-WZII\iG NULMERICAL CONSTANTS (M-4PLE CODE) 73
i f F = EniPbertY then FdomaiP := t r u c e l i f a mod 2 = O than Fdomain := funcsCn - 11 [2] e l se Fdomain := furicsCn + 11 C23 f i ; -REYval := f ; +nge : = e v a i (parte (Frange) 1 ; xf lnrange t h a n
G := invfunc El ; f2 := Re(evalf(G(f))); i f f 2 o O then
ans := constants(f2) ; if ans C> 'FARc than
,REVVal := evaïf(ans C l ] 1 ; indomin : = aval (parse(Fdomain) ) ; i f indomain than
d i f f := abs ( e v a l f < F ( , ~ v a l ) - f 1 ) ; i f d g f < = - t o l then F l y t :=
~ o p ( C l i s t ) , c a t ( . convert CF. s t r ing) , ' (' . convert(ans[l] . s t r i n g ) . ' 1 '11
f i f i
f i f i
f i od ; if C l i s t = then RETûRN(CFAIL') e l s e RETmLN(C1ist) f i
end ;
tryconstproduct := proc(f::float) l o c a l s ;
s := constantproduct Cf) ; i f s c C > 'FAIL' thon ELETURNCcat(
Input matches t h e f ollouing : ' . convert ( s cl] , s t r i n g ) ) ) elsc REïüRN( 'FAIL' f i
end ;
constantproduct := proc(f : :f l o a t ) l o c a l l a n , vect. vect2. W. re la t ion . r d , s i z e , d i f f . sgn. n. nv, ind. t01, i. j;
l e n := max(length(op(1, f)). abs(op(2. i l ) ) ; Dig i t s := ~ ( 1 0 , l a d ; t o l := l . ~ i O - o p ( 2 . f); sgn := sign(f 1 ; vect := iva l f (map(ln, 32) ; Inf := ln(absCf)); n := mh(floor( l /3*len) - 1. 4? ; if n < 2 the= RETüRN<'FAILc) f i ; nv := nops(vsct); i f nv < n thsn n := nv f i ; ind := array(1 .. n); f o r i t o n do indci] := i ad; v h i l e ind[l] <= nv - n + 1 do
vect2 := Clnf. seq(vect CirdCil] , i = 1 . . d l ; r e l := pslq(vect2); i f relCl] O then
r e 1 := - re l / r? l [ l ] ; size := ma?('+ . op(map(x -> ' i f C ( x = O , O , ' i f c (
type(r . in teger ) . 1engthCx). max(length(op(l, XI), length(op(2. XI)) 1). r d ) ) ) :
i f 3*size <= l e n then r e l a t i o n := sgn; f o r i t o n do r e l a t i o n :=
relation*B3 [ind C i ] 1 ' t e l C i + 11 od ; d i f f := abs(f - evalf(re1at ion)) ; i f d i f f C= t o l then ~ ( C r e l a t i o n . d i f f l ) f i
f i f i ; i := n; vhi le 1 < i and indc i l = nv - n + i do i := i - 1 od; indri] := i n d r i ] + 1 ; f o r j from i + 1 t o n do indcj] := i n d r j - 11 + 1 od
od ; RETURN(cFAILc>
end ;
f unctionof ConstProd := proccf : : f loa t )
APPENDUC B. RECOGNIZING NUMERICAL CONSTANTS (MAPLE CODE) 74
loca l l a , F, G. Frange, ùrrange. Fdomaia, indomin, n. f 2, a s , poly. Clist , t o l . diff ; global ,REVvaï, , W p x , funcs;
len := lengthCap(1. f 1) ; Digits := -CS. len) ; t o l := l - ~ * l O - o p ( 2 . f 1 ; , W p i := evalf(Pi1; Clist := ; fo r n t o nops (funcs) do
F := f u n c s ~ ~ l l ; Frange := f u n c s w C21; i f F = LambartY then FdoPiaiP := t r ue e l i f n mob 2 = G tben FdomaiP rr fuacs - 11 [2] e l s e Fdo- := f uncs Cn + 11 C21 f i ; ,REVual := f ; inrange : = aval (parse (Frange 1 1 ; if inrange then
G : = invfuac Cf] ; := Re(eva1f (G(i))) ; f: f 2 <> O a.. ans := constazqroduet Cf21 ; i f ans 0 'FAIL then
-REVval := (ans fi] ; indomain : = aval (paris (Fdomaid ; if bdomain than
diff := abs(evaif<F(_REVval) - f)); i f diff <= t o l t h e n e c p s t := 1
op(C1ist). c a t ( , conve~f(F. s t r i ng ) . '(' , convert (ans C l ] . string) . ' 1 ' 13
f i fi
f i fi
fi od ; i f C l i s t = a then XEïüRN('FAILr) e l s e RETURN(C1ist) f i
end ;
The Interface
The following Maple code is used to call the above procedures. It is intended to have
a mandatory first argument and an optional second argument. The first argument
must be the value one is trying to i d e n t i ~ . The second argument must be an integer
in the range from O to 5 and determines which procedures are called as follows:
O: Cal1 al1 of the above procedures except functionofConstProd.
1: Look only for rational and algebraic values.
2: Look only for functions of rational and algebraic values.
3: Look only for a relation with the selected transcendentals (BI ). 4: Look only for a relation with the seiected constants (82 and B3).
5: Look only for functions of the select constants (BZ). An omitted second agument has the same effect as a second argument of O. Due
the time required to run through all functions in funcs with al1 the subsets of a given
size from B2 or 83, the interface does not cal1 the routine functionofConstProd To
RECOGATZZING NUMERICAL CONSTANTS (MAPLE CODE) 75
identiS. functions of products, the user must cal1 the routine functiono fConstProd
direct ly.
I D := proc0 loca l f . checks, d i g i t s . ansver. ansuer2. i;
nargs=O then RETURH('1nvalid iuaction c a l . ID requires a t l e a r t one arguansnt') f i ; if 1 C nargs theo
checks := args C2l; if not type(checks, ïnteger) o r checks < O o r 5 < checks
then RETüRN( ' Invalid second arguemant a ) f i
e l s e checks := O f i ; i f 2 < nargs then
d ig i t s := args C31: i f ~ g p e < d i g i t s , integer) and O < d i g i t s then
l g i t s := digi t s s i s e RETURN( * invalid t h i rd ~'guement (digi ts) ') f i
f i ; i f typa(args C l ] . integer) then
i f args [l] 0 O then f := ePali(args Cl1 ) else
if checks = 1 or checks = O then R E ' ( ' ï n p u t is the number 0')
f i f i
e l i f type(argsCi3. f loa t ) then f := a rgs l l l e l i f type(evaïf<args C l ] 1. f l oa t ) then f := evalf (args C l ] 1 e l s e RETüRN(aInvalid input') f i ; i f checks = O o r checks = 1 then
ansver : = i s ~ a t (f ) ; i f ansver = FAILr then
pr in t (' input is not a ra t ional of SU height . ' 1 else p r i a t <ansver) f i ; pr&t(c---------------c 1; ansuer := is+ Cf 1 ; i f ansver = F%IL' then
pr in t ( ' Input i s not a small ha ight algebraic numbar of degree betveen 2 and 6. a ) else print(ausuer) f i ; pr&t('--------------'
f i ; 1
i f checks = O o r checks = 2 then ansver := fyctionofRat ( f ) ; i f ansver = FAILc than
print( ' Ipput is not an elementary function of a small rat ional . ') else
p r h t ( ' Input matches the f ollowing functions of rat ionals: ' ) ; *:. f o r i t o nops(answer) do print(ansuerCi1) od CA.
print('-------------4-' 1; ansver := functionofAlg<f) ; i f ansver = 'FAILc then p r i n t (
'Input is not an elementary function of a s m a l l height algabraic nimibar. '1 e l se
pr in t ( 'Input matches the f olloving functions of algebraics : ') ; fo r i to nops(ansver1 do print(ansver[i]) od
f i ; i f checks = O o r checks = 3 then
ansver := i s f rans( f ) ; i f ansver = FAIL' then p r in t (
'No r e l a t i on detected betveen input and se lec ted transcendentals.') else
p r h t ( 'Input matches the f olloving: ') ; for i t o nopsbnsver) do prïnt(ansverCi3) ad
ii. A&. print( ' ---a------ - ----'
fi; 1
if checks = O o r checks = 4 then ansver := tryconsts (f) ;
APPENDX B. RECOGNIZING NUMERICAL CONSTANTS (MAPLE CODE) 76
ansuer2 := t constproduct(f 1 ; if ansmer = TAIL' and ansvar2 = 'FILIL' then
print ( 'No relation detected betveen input and selected constants. * ) ; prin+ ( ' ------------- ' 1
else if -ver <> 'FAILS then
print (ansurr) ; print ( ' ------------ ' 1
if checks = O or checks = 5 than ansuer := f yctionof Consts <f 1 ; if ansver = FAIL' th- print(
'Input is not an elemsntary fonction of a relation of the selected constants.') elsr -
print('input matches the follouing: '1; for i to nops (ansver) do print(uuuerCil1 od
end ;
B.1.4 Some Exampies
The following examples demonstrate the procedures described above:
Input is not a rational o f small height. --------------- Input matches the following radical expression: sqrt( 3/8 ) - sqrt( 1/8 ) ---------------
Input is not an elementary function of a small rational . --------------- Input is not an elementary function of a s m a l l height algebraic number. ---------------
No re lat ion detected betveen input and selected transcendentals. --------------- No relat ion detected betveen input and selected constants. ---------------
Input matches the f ol loving :
s in( l / l2*f i )
cos (5/12*Pi)
APPENDDC B. RECOGNIZ'G NUMERTCAL CONSTANTS (MAPLE CODE) 77
Input matches the fo l lov ing rational: 13/877. --------------- Input is not a small height algebraic number of degree betueen 2 and 6 . ---------------
Input is not a rational of srnall height. --------------- Input matches the folloving radicaï expression: i + sqrt( 7/2 ) .+ sqr t ( 1/2 ) ---------------
> evalf (sqrt (17-il-(1/3) )+4,25) ; ID(%,l) ;
7.843958884981820988420160
Input is not a rational of srnall height. --------------- Input matches the folloving radical expression: 4 + sqrt ( 17 - ( 11 )"(1/3) ) ---------------
Input matches the f ollouing f unctions of rationals:
Input matches the fol loving functions of algebraics:
APPENDD[ B. RECOGNIZING NUMERICAL CONSTANTS (MAPLE CODE) 78
> evalf ( a r c c s c ( l + l 7 ~ ~ 1 / 3 ) ,151 ; ID(%,2) ;
Input is not an elementary function of --------------- Input matches the f ollowing fuuctions
a small rationaï .
of aïgebraics:
arcsin of the follouing root of -18*x-3+3*x'2-3*x+1: .280011523766650
> evalf (7+l/sqrt (P i ) +Pi"2,15) ; ID(%,3) ;
17.4337939846371
Input matches the f ollowing :
> evaif (Pi + exp(1)) ; I D ( % A ;
5.859874482
Input matches the f ollowing : Pi+exp (1)
> evalf (5/17*~i-3/7*ln(3)+9,20) ; I D ( % , 4 ) ;
9.4531640012904972192
Input matches the following: 9+5/17*Pi-3/7*ln(3) ---------------
APPENDIX B. RECOGMZING NUMERICAL CONSTANTS (MAPLE CODE) 79
Input matches the f ollowing:
> evaif (sin(Zeta(3) -3*Pi/8) J5) ; functionofConstProd(%);
.630408588369749
C sin(l/S*Zeta(3) ^3*Pi)1
> ~2:=[1 ,Pi, zeta(3) ,zeta(5) ,~i*~eta(3) ,~i'2*~eta(3) ,Pi*Zeta(S ,pi-2*Zeta(5)] : > evalf (~i+7*Zeta(3) +3*Pia2*Zeta(3) -l7,2O) ; ID(%,4) ;
30.147469281058283366
Input matches the follouing: Pi+7*Zeta(3)+3*Pi^2*Zeta(3)-17 ---------------
> ~3:=[2,3,5,7,Pi,exp(l) ,ln(2), (Pi+exp(l)), (Pi+ln(2)11 : > evalf (l25*Pi* (Pi+exp (1) ) * (Pi+ln(S) -l7,2O) ; ID(%,4) ;
.19295613038714013599 10'14
Input matches the f ollowing : l25*~i* (~i+exp (1) ) * (Pi+ln(2) ) -17 ---------------
Bibliography
[1] David H. Bailey and David J. Broadhurst, ParaIlel integer relation detection:
Techniques and applications, to appear in Mat hematics of Comyutation.
David H. Bailey and Helamm R. P. Ferguson, Numerical results on relations
between fundamental constants using a new algorithm, Mathematics of Cornpu-
tation 53 (19891, no. 188, 649-4356? (The PSOS algorithm).
David H. Bailey and Simon Plouffe, Recognzzing numerical constants, Proceedings
of the Workshop on Organic Mathematics, Canadian Mathematical Society 20
(1997), 73 - 88.
Helaman R. P. Ferguson, David H. Bailey, and Steve Arno, Analysis of PSLQ, an integer relation finding algon'thm, Mathematics of Computation 68 (1999),
no. 225, 331 - 369.
Borwein and Borwein, A dictionary of real nurnbers, Wadsworth & Brooks/Cole,
Pacific Grove, Calif., 1990.
J. M. Borwein and P. Lisonek, Applications of integer relation algorithrns, Dis-
crete Mathematics (Special issue for FPSAC 1997) 217 (2000), 65-82, [CECM
Research Report 97: 1041.
Henri Cohen, A course in computational algebraic nurnber theory, Graduate Texts
in Mathematics, no. 138, Springer, 1993.
[8] H. R. P. Ferguson and R. W. Forcade, Generalization of the Euclidean algorithm
for real numbers to al1 dimensions higher than tuo, Bulletin (New Series) of the
American Mathematical Society 1 (1 979), no. 6 , 912 - 914.
[9] Helarnan Ferguson, A short proof of the existence of vector Euclidean algorithms,
Proceedings of the -4merican Mathematical Society 97 (l986), no. 1, 8 - 10.
[IO] Kelaman R. P. Ferguson, A noninductive GL(n,Z) algorithm that wnstnic ts
integral linear relations for n Z-linearly dependent real numbers, Journal of Al-
gorithrns 8 (1987), 131 - 145.
[Il] A. K. Lenstra, H. W. Lenstra Jr., L. LovAsz, Factoring polynomials with ratzonal
coeficients, Math. Ann. 261 (1982), 515 - 534.
(121 S. PloufFe, The Inverse Syrnbolic Calculator, nrww.cecm.sfu.ca/projects/ISC/.
[13] Kenneth H. Rosen, Elementary nurnber theory and its applications, 3rd ed.,
-4ddison- Wesley, 1993.
[14] J. Hastad, B. Just, J. C. Lagarias, C. P. Schnorr, Polynomial time algorithms
for finding integer relations among real numbers, SIAM Journal of Computing
18 (l989), no. 5, 859 - 881.
[ E l B. Vallée, Une approche géométrique des algorithmes de réduction en petite di-
mension, Ph.D. thesis, Univ. of Caen, 1986.