# Pi Unleashed

###### Jörg Arndt and Christoph Haenel
Publisher:
Springer
Publication Date:
2001
Number of Pages:
276
Format:
Paperback with CDROM
Price:
52.95
ISBN:
978-3540665724
Category:
General
[Reviewed by
Carl D. Mueller
, on
10/3/2002
]

This number will probably look familiar to the readers of this review, and most readers can probably point to at least one digit that is not what was expected. In fact, the number above is the beginning of the decimal representation of the sum of the first 50,000 terms of the series 4 (1 - 1/3 + 1/5 - 1/7 + ... ). The full infinite series adds to π but does so very very slowly. Since this is an alternating series, it is easy to determine that the partial sum of these 50,000 terms should be within about 0.00004 of π. So, the fact that it is close to but not exactly π is not surprising. What is surprising is that so many of the decimal places are correct! Only three of the digits listed above are incorrect. The reasons for this were explained in an article in the American Mathematical Monthly [Vol. 96 (1989), 681-687] and are contained in the book being reviewed here.

Let me begin this review by stating simply that I know of no better book than this one for those interested in everything π. While the book itself has fewer than 300 pages, it is packed with information, formulas, historical notes, etc. Just about anything you could want is here. The following list of chapter titles should give an idea of what is here: The State of π Art, How Random is π?, Shortcuts to π, Approximations for π and Continued Fractions, Arcus Tangens, Spigot Algorithms, Gauss and π, Ramanujan and π, The Borweins and π, The BBP Algorithm, Arithmetic, Miscellaneous, The History of π, Historical Notes, The Future: π Calculations on the Internet, π Formula Collection, Tables. In addition, there is a brief appendix: Documentation for the hfloat Library. There is a very good index, and, for those interested in more details than this book can provide, there is a lengthy bibliography with 123 references.

The CD-ROM that comes with the book is also quite full. Much of the space is taken up with raw data. The first one million decimal places of π, the first one million hexadecimal places of π, the first 20,000 decimal places of e, and the first 10,000 decimal places of log(2) are included in dvi and ps formats. And, the first 400 million digits of π are included in a set of 40 text files. But, the real prizes on this CD-ROM are the libraries and algorithms. The hfloat (huge float) package is included as are apfloat (a C++ arbitrary precision library by Mikko Tommila) and cln (a class library for numbers by Bruno Haible). Also, Carey Bloodworth's piagm package for high precision (π) calculations is included. There is source code for the BBP algorithm, arctan formulas for calculating digits of π, the spigot algorithm, monte carlo algorithms, and more. Executables (mostly for DOS or Windows) are included with most of the source code.

π Unleashed can be used as a reference book or it can be read straight through as one would read a textbook or a novel. It begins with an overview of π. The latest record is given, several formulas and algorithms are presented and discussed briefly, and the question of whether or not π is normal is asked. Later chapters expand on these and other issues. A brief chapter discusses what is known thus far about the distribution of the digits in the decimal representation of π and presents some oddities and statistical results. Separate chapters are devoted to the roles of Gauss, Ramanujan, and the Borweins in the history of π calculation.

Several algorithms are discussed in some detail. The spigot algorithm for calculating π is presented as is a similar algorithm for calculating e. This is an interesting algorithm in that the digits are not computed all at once but sequentially in chunks of several digits. This means that large storage buffers are not necessary and makes it an ideal algorithm for desktop computers. What makes this book especially nice is that when algorithms are presented, they are explained thoroughly. Not only is the mathematics explained (so that we understand that the result will indeed be π) but so too is the programming logic (so that we see what makes the algorithm efficient). The amazing BBP algorithm (which gives isolated hexadecimal digits of π) is also described. Code for both of these algorithms is included on the CD-ROM provided with the book.

There is a chapter on arithmetic. This may seem strange in a book on π, but when a computer is used to calculate billions of digits of π, it is not enough to have an efficient π algorithm. It is also necessary to perform arithmetic operations as efficiently as possible. In particular, an efficient method for multiplication of long numbers can have an enormous effect on the time required for such calculations. Ordinary multiplication of N digit numbers requires a time proportional to N squared. A technique called Karatsuba multiplication (described in the book) requires a time proportional to N raised to the 1.583 power. While this is an enormous savings when N is large, a third method called FFT multiplication requires a time proportional to only N log(N). This gives an astonishing savings over either of the other methods. FFT multiplication is discussed in the book and there is a tutorial on the method on the CD-ROM. Techniques for rapid division and root extraction are also discussed in the book.

Two chapters are especially nice for those who enjoy tables of various sorts. An entire chapter is devoted to π formulas. There are 154 different formulas for computing π and related constants. The final chapter of the book contains tables of digits: 5000 decimal digits of π, 5000 hexadecimal digits of π, 2000 continued fraction elements (decimal) of π, and for good measure, 100 digits of many constants relating to π and e.

There is more in the book: fascinating π trivia, intriguing formulas, and predictions for the future. There is far too much to describe in a brief review. Of course, no book is perfect and this one has a few minor errors (perhaps occurring in the translation process) such as the description of the constant e as a limiting balance in an interest bearing account earning "100% interest per interest period" as "this interest period became ever shorter." Clearly, this should read 100% interest per year. But these mistakes are minor and do not detract from the overall quality of the book. This book is a must have for π aficionados and would fit comfortably in the mathematics collection of high school and university libraries. I recommend it highly.

Carl D. Mueller (cmueller@canes.gsw.edu) is Associate Professor of Mathematics at Georgia Southwestern State University in Americus, GA.

1. The State Of Pi Art 1
2. How Random Is pi? 21
2.1 Probabilities 21
2.2 Is pi normal? 21
2.3 So is pi not normal? 24
2.4 The 163 phenomenon 25
2.5 Other statistical results 28
2.6 The Intuitionists and pi 30
2.7 Representation of continued fractions 32
3. Shortcuts To pi 35
3.1 Obscurer approaches to pi 35
3.2 Small is beautiful 37
3.3 Squeezing pi through a sieve 38
3.4 pi and chance (Monte Carlo methods) 39
3.5 Memorabilia 44
3.6 Bit for bit 47
3.7 Refinements 49
3.8 The pi room in Paris 50
4. Approximations For pi And Continued Fractions 51
4.1 Rational approximations 51
4.2 Other approximations 55
4.3 Youthful approximations 63
4.4 On continued fractions 64
5. Arcus Tangens 69
5.1 John Machin's arctan formula 69
5.2 Other arctan formulae 72
6. Spigot Algorithms 77
6.1 The spigot algorithm in detail 78
6.2 Sequence of operations 80
6.3 A faster variant 82
6.4 Spigot algorithm for e 84
7. Gauss And pi 87
7.1 The pi AGM formula 87
7.2 The Gauss AGM algorithm 90
7.3 Schönhage variant 92
7.4 History of a formula 94
8. Ramanujan And 103
8.1 Ramanujan's series 103
8.2 Ramanujan's unusual biography 105
8.3 Impulses 110
9. The Borweins And pi 113
10. The BBP Algorithm 117
10.1 Binary modulo exponentiation 120
10.2 A C program on the BBP series 123
10.3 Refinements 126
11. Arithmetic 131
11.1 Multiplication 131
11.2 Karatsuba multiplication 132
11.3 FFT multiplication 135
11.4 Division 145
11.5 Square root 146
11.6 nth root 149
11.7 Series calculation 150
12. Miscellaneous 153
12.1 A pi quiz 153
12.2 Let numbers speak 154
12.3 A proof that pi = 2 155
12.4 The big change 155
12.5 Almost but not quite 156
12.6 Why always more? 158
12.7 pi and hyperspheres 158
12.8 Viète × Wallis = Osler 160
12.9 Squaring the circle with holes 162
12.10 An (in)finite funnel 164
13. The History Of pi 165
13.1 Antiquity 167
13.2 Polygons 17 0
13.3 Infinite expressions 185
13.4 High-performance algorithms 198
13.5 The hunt for single pi digits 203
Table: History of pi in the pre-computer era 205
Table: History of pi in the computer era 206
Table: History of digit extraction records 207
14. Historical Notes. 209
14.1 The earliest squaring the circle in history? 209
14.2 A pi law 211
14.3 The Bieberbach story 213
15. The Future: pi Calculations On The Internet 215
15.1 The binsplit algorithm 215
15.2 The pi project on the Internet 219
16. pi Formula Collection223
17. Tables 239
17.1 Selected constants to 100 places (base 10) 239
17.2 Digits 0 to 2,500 of pi (base 10) 240
17.3 Digits 2,501 to 5,000 of pi (base 10) 241
17.4 Digits 0 to 2,500 of pi (base 16) 242
17.5 Digits 2,501 to 5,000 of pi (base 16) 243
17.6 Continued fraction elements 0 to 1,000 of pi 244
17.7 Continued fraction elements 1,001 to 2,000 of pi 245
A. Documentation For The hfloat Library 247
A.1 What hfloat is (good for) 247
A.2 Compiling the library 248
A.3 Functions of the hfloat library 248
A.4 Using hfloats in your own code 250
A.5 Computations with extreme precision 250