remarks on arithmetical algorithms and the computation of

advertisement
remarks on arithmetical algorithms
and the computation of Jorg Arndt
arndt@jjj.de
This document1 was LaTeX'd at September 18, 1997
1
This document is enclosed in the hfloat-package which is online at
http://www.jjj.de/hfloat/
Abstract
1
d
This is a collection of remarks
p about some arithmetical algorithms. If you think iterating x 7! 2 (x + x )
is the best way to compute d then have a look.
In addition there is a collection of formulas and iterations for the computation of . Some of the formulas
are highly cryptic and useless. If you think that
1
= 88 arctan 1 + 39 arctan 1 + 100 arctan 1 32 arctan 1
4
192
239
515
1068 56 arctan 173932
is fun then stare at more formulas there.
Things are treated pretty supercially, always see the references for details. Do not expect mathematics,
expect formulas, ideas and algorithms. Some sections are mere formula buckets or enumerations of names
or references, don't panic.
Please report errors and typos !
Contents
1 Remarks on arithmetical algorithms
1.1 Asymptotics of algorithms . . . . . . . . . . .
1.2 Multiplication of large numbers . . . . . . . .
1.2.1 Fast multiplication via FFT . . . . . .
1.2.2 The Karatsuba algorithm . . . . . . .
1.2.3 Other methods for multiplication . . .
1.3 Power computations . . . . . . . . . . . . . .
1.4 Division, square root and cube root . . . . . .
1.4.1 Division . . . . . . . . . . . . . . . . .
1.4.2 Square root extraction . . . . . . . . .
1.4.3 Cube root extraction . . . . . . . . . .
1.5 A general procedure for the inverse n-th root
1.6 n-th root by Goldschmidt's algorithm . . . .
1.7 Trancendental functions & the AGM . . . . .
1.7.1 The AGM . . . . . . . . . . . . . . . .
1.7.2 log . . . . . . . . . . . . . . . . . . . .
1.7.3 exp . . . . . . . . . . . . . . . . . . . .
1.7.4 sin, cos, tan . . . . . . . . . . . . . . .
1.8 Inverting a function . . . . . . . . . . . . . .
1.8.1 Householders formula . . . . . . . . .
1.8.2 Schroders formula . . . . . . . . . . .
1.9 Addition of oating point numbers . . . . . .
2 Remarks on the computation of 2.1 Arctan formulas . . . . . . .
2.2 How to build arctan formulas
2.3 Ramanujan type formulas . .
2.3.1 Type 1 n = 58 . . . .
2.3.2 Type 1 n = 862 . . . .
2.3.3 Type 2 n = 37 . . . .
2.3.4 Type 3a n = 7:::163 .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
4
4
5
5
6
6
6
6
7
7
8
9
9
9
10
10
10
10
11
11
13
13
16
17
18
18
19
19
CONTENTS
2.4
2.5
2.6
2.7
2.8
2.9
2.10
2.11
2.12
2.13
2.14
2.3.5 Type 3c n = 1555 . . . . . . . . . .
2.3.6 Type 3b n = 190 . . . . . . . . . . .
How to build Ramanujan type formulas . .
Approximations for . . . . . . . . . . . .
Iterations . . . . . . . . . . . . . . . . . . .
How to build iterations . . . . . . . . . . . .
Geometric iterations for . . . . . . . . . .
Products for . . . . . . . . . . . . . . . .
Continued fractions for . . . . . . . . . .
2.10.1 The simple continued fraction for 2.10.2 other continued fractions for . . .
Series for . . . . . . . . . . . . . . . . . .
Miscellaneous formulas for . . . . . . . . .
A bit recursion for 1= . . . . . . . . . . . .
A self correcting iteration for . . . . . . .
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
19
20
21
22
23
26
27
28
30
30
30
31
33
34
34
A How to build Ramanujan type formulas
36
B More arctan formulas
43
C Continued fractions
48
D A modulo multiplication trick
50
Chapter 1
Remarks on arithmetical algorithms
1.1 Asymptotics of algorithms
An important feature of an algorithm is the number of operations that must be performed for the
completion of a task a certain size N. N should be some reasonable quantity that grows strictly with
the size of the task, for high precision computations one will take the length of the numbers counted in
decimal digits or bits. For computations with square matrices one may take for N the number of the
rows. An operation is typically a (machine word) multiplication plus an addition, one could also simply
count machine instructions.
An algorithm is said to have some asymptotics f(N) if it needs proportional f(N) operations for a task
of size N.
Examples:
Addition of an N-digit number needs proportional N operations (here: machine word addition plus
some carry operation).
Ordinary multiplication needs N 2 operations.
The Fast Fourier Transform (FFT) needs N log(N) operations (a straightforward implementation
of the Fourier Transform, i.e. computing N sums each of length N would be N 2).
Matrix multiplication is N 3 (N 2 sums each of N products).
The algorithm with the `best' asymptotics wins for some, possibly huge, N. For smaller N some other
algorithm will be superior. For the exact break-even point the constants omitted elsewhere are of course
important.
Example: Let the algorithm mult1 take 1:0 N 2 operations, mult2 take 8:0 N log2 (N) operations. Then
for N < 64 mult1 is faster and for N > 64 mult2 is faster. Often completely dierent algorithms are
optimal for the same task at dierent problem sizes.
See [62], [16] and [5].
3
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
4
1.2 Multiplication of large numbers
1.2.1 Fast multiplication via FFT
Ordinary multiplication is N 2. Computing the product of two million digit numbers would require
1012 operations, taking (in the order of) 1 day on a machine that does 10 million operations per second.
But there is a better way:
1.) Note that multiplication of two numbers is essentially a convolution of the sequences of their digits.
A convolution ck ; k = 0:::2N 2 of the two sequences ak ; bk; k = 0:::N 1 is dened as
ck :=
NX1
i;j =0;i+j =k
ai bj :
(1.1)
A number written (in radix r) as
aP aP 1 ::: a2 a1 a0 : a 1 a 2 ::: a p+1 a p
denotes a quantity of
P
X
ai ri = aP rP + aP 1 rP 1 + ::: + a p r p :
i= p
i.e. digits are coecients of a polynomial in r. (e.g. for decimal numbers r = 10 and 123:4 = 1 102 + 2 101 + 3 100 + 4 10 1). The product of two numbers is almost the polynomial product
X
2N 2
k=0
ck rk :=
NX1
i=0
ai r i
NX1
j =0
bj rj
(1.2)
P
1
The ck are found by comparing coecients, one gets ck = Ni;j =0;
i+j =k aibj , apparently a convolution.
As the ck can be greater (or equal) r, the carry operations have to be appended: go from right to left,
replace ck by ck %r and add (ck ck %r)=r to its left neighbour.
Here is a tiny decimal example:
.82
.34
32
24 6
24 38
=.2 2 7 3 8
8
8
8
2.) Note that convolution can be done eectively using the Fast Fourier Transform (FFT): Convolution is a simple (elementwise array) multiplication in Fourier space (see e.g. [46]). The
FFT itself takes N logN operations. Instead of the direct convolution ( N 2 ) one does
f FFT; array multiplication; FFT 1; g
The operation count is dominated by that of the FFT's (the array multiplication is of course N), so
the whole fast convolution algorithm takes N logN operations. The following carry operation is also
N and can therefor be neglected when counting operations.
Well, N log N is not really the truth: it has to be N log N log logN. This is because the sums in the
convolutions have to be represented as exact integers. The biggest term cmax that can possibly occur
(when multiplying two N-digit numbers made of all `nines', i.e. R 1) is the central one, it is the sum of
N times (R 1)(R 1) or approximately
cmax NR2
(1.3)
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
5
a number with proportional log N bits. Therefor, working with some xed radix R one has to do
FFTs with log N bits precision, leading to an operation count of N log N log N. The slightly better
N logN loglog N is obtained by recursive use of FFT multiplies. For realistic applications (where the
sums in the convolution all t into the machine type oating point numbers) it is safe to think of FFT
multiplication being proportional N logN.
Multiplying our million digit numbers will now take only 106 log2(106 ) 106 20 operations, taking (in
the order of) 2 seconds on a 10 Mips machine.
See [61].
1.2.2 The Karatsuba algorithm
Split the numbers U and V in two pieces:
U = U0 + U1 B
V = V0 + V1B
Instead of the straightforward multiplication
UV = U0 V0 + B(U0 V1 + V0U1 ) + B 2 U1 V1
(4 multiplications with half precision for one multiplication with full precision)
use the relation
UV = (1 + B)U0 V0 + B(U1 U0 )(V0 V1 ) + (B + B 2 )U1 V1
(3 multiplications with half precision for one multiplication with full precision)
recursively.
For Squaring the relation is:
U 2 = (1 + B)U02 B(U1 U0 )2 + (B + B 2 )U12
or
U 2 = (1 B)U02 + B(U1 + U0 )2 + ( B + B 2 )U12
(1.4)
(1.5)
(1.6)
(1.7)
(1.8)
The asymptotics of the algorithm is N log (3) N 1:585.
One can extend the above idea by splitting U and V into more than two pieces each, the resulting
algorithm is called Toom Cook algorithm.
See [5], chapter 4.3.3 (`How fast can we multiply ?').
2
1.2.3 Other methods for multiplication
Binary algorithm: only shift-, bittest- and add- operations required.
Systolic arrays.
Modular multiplication.
Montgomery multiplication is a method for eective multiplication of two numbers modulo M.
With this method the modulus can be replaced by another modulus N (that must be greater than
and prime to M). E.g. for M odd one can choose N = 2k . See [6].
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
6
1.3 Power computations
See [5] and [6] !
1.4 Division, square root and cube root
1.4.1 Division
The ordinary division algorithm is useless for numbers of extreme precision. Instead one replaces does
the division ab as a 1b . The inverse of b is computed by nding a starting approximation x0 1b and then
iterating
xk+1 = xk + xk (1 b xk )
(1.9)
until the desired presision is reached. The convergence is quadratical (2.order), which means that the
number of correct digits is doubled with each step: if xk = 1b (1 + ) then
xk+1 = 1b (1 + ) + 1b (1 + )(1 b 1b (1 + ))
(1.10)
= 1b (1 2)
(1.11)
Moreover each step needs only computations with twice the number of digits that were correct at its
beginning. Still better: the multiplication xk (:::) needs only to be done with half precision as it computes
the `correcting' digits (which alter only the less signicant half of the digits). Thus at each step we have
1.5 multiplications of the `current' precision. The total work1 amounts to
1:5 n<
X1 1 n
n=0
2
which is less than 3 full precision multiplications. together with the nal multiplication a division costs
as much as 4 multiplications. Another nice feature of the algorithm is that it is self-correcting. Cf. gure
1.4.1 for a numerical example.
1.4.2 Square root extraction
p
is quite similar: rst compute p1d then a nal multiply with d gives d. Find a starting approximation
x0 p1b then iterate
2
xk+1 = xk + xk (1 2d xk )
(1.25)
until the desired precision is reached. Convergence is again 2.order. Similar considerations as above (with
squaringpconsidered as expensive as multiplication2) yield an operation count of 4 multiplications for p1d
or 5 for d.
Note that this algorithm is considerably better than the usual one where xk+1 := 21 (xk + xd ) is iterated,
as long divisions are involved.
k
1 The asymptotics of the multiplication is set to N (instead of N log(N )) for the estimates made here, this gives a
realistic picture for large N .
2 Indeed it costs about 2 of a multiplication.
3
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
7
b := 3:1415926
x0 = 0:31 2 digit approximation for 1=b
now use 4 digits:
b x0 = 3:141 0:3100 = 0:9737
y0 := 1:000 b x0 = 0:02629
x0 y0 = 0:3100 0:02629 = 0:0081(49)
x1 := x0 + x0 y0 = 0:3100 + 0:0081 = 0:3181
now use 8 digits:
b x1 = 3:1415926 0:31810000 = 0:9993406
y1 := 1:0000000 b x0 = 0:0006594
x1 y1 = 0:31810000 0:0006594 = 0:0002097(5500)
x2 := x1 + x1 y1 = 0:31810000 + 0:0002097 = 0:31830975
last step with 8 digits ... homework !
(1.12)
(1.13)
(1.14)
(1.15)
(1.16)
(1.17)
(1.18)
(1.19)
(1.20)
(1.21)
(1.22)
(1.23)
(1.24)
Figure 1.1: Computation of 1= to 8 digits by a second order iteration.
1.4.3 Cube root extraction
Use d1=3 = d (d2) 1=3, i.e. compute the inverse third root of d2 using the iteration
2 3
xk+1 = xk + xk (1 3d xk )
nally multiply with d.
(1.26)
1.5 A general procedure for the inverse n-th root
There is a nice general formula that allows to build iterations with arbitrary order of convergence for
d 1=a that involve no long division.
One uses the identity
d 1=a = x (1 (1 xa d)) 1=a
(1.27)
1
=a
= x (1 y)
(1.28)
where y := (1 xa d).
Taylor expansion gives
X
d 1=a = x (1=a)k yk
1
where z k := z(z + 1)(z + 2):::(z + k 1).
(1.29)
k=0
d 1=a =
(1.30)
2
+ 2a) y3 + (1 + a)(1 + 2a)(1 + 3a) y4 + :::
= x 1 + ya + (1 +2 aa)2 y + (1 + a)(1
6 a3
4! a4
(1.31)
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
8
A n-th order iteration for d 1=a is obtained by truncating the above series after the (n 1)-th term,
n (a; x) := x
xk+1 =
nX1
(1=a)k yk
k=0
n (a; xk)
(1.32)
(1.33)
e.g. second order:
a
2 (a; x) := x + x (1 adx )
(1.34)
Convergence:
n (d 1=a(1 + )) = d 1=a (1 + n + O(n+1 ))
Examples:
a = 1: inverse
1 = x 1
d
1 y
= x 1 + y + y2 + y3 + y4 + :::
2(1; x) was described in the last section.
a = 2: inverse square root
p1 = x p11 y
d
2k k 1
0
y
2 5 y3 35 y4
y
3
y
= x @y + 2 + 8 + 16 + 128 + ::: + k4k + :::A
(1.35)
(1.36)
(1.37)
(1.38)
(1.39)
2(2; x) was described in the last section.
In hfloat, the second order iterations of this type are used. At the second last step the third order
correction is used to assure maximum precision at the last step.
1.6 n-th root by Goldschmidt's algorithm
Set
x0 := da
then iterate:
y0 := db
rk := a + 1a yk
xk+1 := xk rkb
yk+1 := yk rka
(1.40)
(1.41)
(1.42)
(1.43)
until x close enough to
x1 = d
a
a
b
:
(1.44)
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
This is because
and
9
xa0 = da b
y0b
(1.45)
xak+1
k rb )a = xak
= (x
b
(yk ra )b ykb
yk+1
(1.46)
e.g. (with b = 1)
1
Y
d 1=a =
k=0
where E0 := d and Ek+1 := Ek a+1a E a .
(2 Ek )
(1.47)
k
1.7 Trancendental functions & the AGM
1.7.1 The AGM
The AGM (arithmetic geometric mean) plays a central role in the (high precision) computation of logarithms and .
The AGM(a; b) is dened as the limit of the iteration
p
(ai+1 ; bi+1) := ( ai +2 bi ; ai bi)
(1.48)
starting with (a0 ; b0) = (a; b). Both of the values converge quadratically to a common limit.
One further denes (cf. [15] p.221)
R0(k) :=
"
1
1
X
n=0
2n 1c2n
#
1
where c2n := a2n b2n corresponding to AGM(1; k).
A quartic variant of the AGM (AGM4) can be written as
(2 + 2 ) 1=4!
+
i
i
i i i
i
(i+1 ; i+1) :=
2 ;
2
p
p
starting with (0 ; 0) = (pa0 ; b0) then (k ; k ) = (pa2k ; b2k).
Then
" X
2 + 2 2!# 1
1
n
n
R0(k) = 1
4n 4n
2
n=0
(1.49)
(1.50)
(1.51)
p
corresponding to AGM4(1; k) (cf. [15] p.17).
1.7.2 log
The (natural) logarithm can be computed using the following relations (cf. [15] p.221)
log(x) R0(10 n) + R0(10 n x) n
2(
10 n 1)
that hold for n 3 and x 2] 21 ; 1[.
(1.52)
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
10
1.7.3 exp
The exponential function is computed using the log and the iteration that comes from truncating the
series
exp(d) = x exp (d log(x))
(1.53)
2
3
(1.54)
= x 1 + y + y2 + y3! + :::
where y := d log(x).
A n-th oder iteration
xk+1
2
3
n 1
= xk 1 + y + y2 + y3! + ::: (ny 1)!
(where y := d log(xk ))
As the computation of one log is expensive one would use a higher (e.g. 8-th) order iteration.
If one had some ecient algorithm for exp one could compute log from exp using
log(d) = x + log(1 + (d exp( x) 1))
2 y3
y
= x + 1 + y + 2 + 3 + :::
(1.55)
(1.56)
(1.57)
where y := d exp( x) 1.
1.7.4 sin, cos, tan
For the arcsin ; arccos ; arctan functions use the complex analogue of the AGM. For the sin; cos; tan
use the exp iteration above & think complex.
1.8 Inverting a function
I am aware of two formulas that produce iterations for x = f 1 (d) for general f():
1.8.1 Householders formula
xk+1
1 (n 2)
7 n (xk ) := xk + (n 1) f (x ) (n 1) + f(xk )n+1
!
1
k
(1.58)
f (xk )
(where n 2 and is an arbitrary function that is set to zero in what follows, cf. [63])
gives a n th order iteration that converges against x so that f(x ) = 0.
For n = 2 this is Newton's formula:
2(x) := x ff0
For n = 3 this is Halley's formula:
0
3 (x) := x 2f 22ffff 00
(1.59)
(1.60)
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
11
n = 3 gives:
00 2f 02 )
4 (x) := x 6ff3f(ff
0 f 00 6f 03 ff 000
Second order 1.58 with f(x) := x1
long divisions.
a
(1.61)
d gives 1.34, but for higher orders one gets iterations that require
1.8.2 Schroders formula
xk+1 7! n(xk ) :=
n
X
t=0
(
1 t 1 1
n+1
t!
f 0 (xk ) @
f 0 (xk ) f(xk ) '
t
1)t f(xk )
(where n 2 and ' is an arbitrary function that is set to zero in what follows cf. [14] p.13)
gives a n th order iteration that converges against x so that f(x ) = 0.
This is, written out,
2
00
3
002 0 000
n = x 1!f f10 f2! ff03 f3! 3f f 05f f
f 4 15f 003 10f 0 f 00 f 00 + f 02 f 00 f 0000
4!
f 07
7
00
4
f 105f
105f 0f 002 f 000 + 10f 02 f 0002 + 15f 02f 0000 f 03 f 00000
7!
f 09
:::
(1.62)
(1.63)
(1.64)
(1.65)
(1.66)
The second order iteration is the same as the corresponding iteration from 1.58 while all higher order
iterations are dierent.
\If we denote the general term by
f a a
(1.67)
a! f 2a 1
the numbers a can easily computed by the recurrence
a+1 = (2a 1)f 00 a f 0 @a
(1.68)
.\ (cited from [14], p.16).
Formula 1.62 with f(x) := 1=xa d gives the iteration 1.32 for arbitrary order.
Formula 1.62 with f(x) := log(x) d gives the iteration 1.7.3.
The le doc/bucket/iter.mu is a mupad3 script to experiment with. It produces the iterations 1.62 and
1.58 for arbitrary f(x). A sample output is in doc/bucket/itermu.out.
1.9 Addition of oating point numbers
coding a function add(a,b,c) := `add a to b and put result into c'
and sub(a,b,c) := `sub b form a and put result into c'
one must consider that
3
mupad is a freeware computer algebra system that should be on your computer.
CHAPTER 1. REMARKS ON ARITHMETICAL ALGORITHMS
1.)
2.)
3.)
4.)
any of a,b,c can be identical
dierent exponents cause an oset in add/sub
action is also determined by the signs (of a and b)
any combination of precisions can occur
12
Chapter 2
Remarks on the computation of 2.1 Arctan formulas
Formulas of the form
k 4 =
N
X
i=1
mi arctan x1
i
(2.1)
(k 2 N; mi 2 Z; xi 2 N)
where all x2i + 1 factor completely into factors in
F := f2; 5; 13; 17;29;37;41;53; 61; 73; 89; 97; 101;109;113g
(2.2)
(exceptions are formulas 2.13 and 2.15).
For some of the formulas the factors are given in curly braces1 .
All these formulas were built in 1992 with a mixture of C-programs and Computer Algebra. For the
known formulas the original authors are given.
Formulas 2.7 and 2.8 were used for the 100,000 digit computation of in 1961, see [33]. Machin's formula
(2.6) was often used in -computations before 1960. The computations used the expansion
arctan x1 = x1 3 1x3 + 5 1x5 7 1x7 + :::
(2.3)
Another expansion is given by
1 2 1
1
2
4
1
2
4
6
1
arctan x = x x2 + 1 + 3 (x2 + 1)2 + 3 5 (x2 + 1)3 + 3 5 7 (x2 + 1)4 + :::
(2.4)
= arctan 1 + arctan 1
4
2
3
(2.5)
= 4 arctan 1 arctan 1
4
5
239
(2.6)
f5g
f13g
1 the 2 is always omitted.
(Euler, 1706)
(Machin, 1776)
13
CHAPTER 2. REMARKS ON THE COMPUTATION OF 14
= 6 arctan 1 + 2 arctan 1 + arctan 1
4
8
57
239
(2.7)
= 12 arctan 1 + 8 arctan 1 5 arctan 1
4
18
57
239
(2.8)
= 44 arctan 1 + 7 arctan 1 12 arctan 1 + 24 arctan 1
4
57
239
682
12943
(2.9)
f5,13g
f5,13g
(Strmer, 1896)
(Gauss)
f5,13,61g
(Strmer, 1896)
= 88 arctan 1 + 51 arctan 1 + 32 arctan 1 +
4
172
239
682
1
1
+44 arctan 5357 + 68 arctan 12943
(2.10)
= 88 arctan 1 + 39 arctan 1 + 100 arctan 1
4
192
239
515
1
1
32 arctan 1068 56 arctan 173932
(2.11)
= 100 arctan 1 + 127 arctan 1 + 71 arctan 1
4
319
378
557
1
1
1
15 arctan 1068 + 66 arctan 2943 + 44 arctan 478707
(2.12)
= 322 arctan 1 + 76 arctan 1 + 139 arctan 1 +
4
577
682
1393
1
1
1
+156 arctan 12943 + 132 arctan 32807 + 44 arctan 1049433
(2.13)
= 1074 arctan 1 + 657 arctan 1 + 183 arctan 1
4
1568
4662
5357
1
1 +
1
779 arctan 12943 32 arctan 17923 449 arctan 32807
1
+398 arctan 390112
(2.14)
= 1587 arctan 1 + 295 arctan 1 + 593 arctan 1 +
4
2852
4193
4246
1
1
1
+359 arctan 39307 + 481 arctan 55603 + 625 arctan 211050
1
708 arctan 390112
(2.15)
f5,13,61,97g
(Strmer, 1896)
f5,13,73,101g
f5,13,17,41,73g
f5,13,61,89,197g
f5,13,17,61,89,97g
f5,13,17,29,97,433g
CHAPTER 2. REMARKS ON THE COMPUTATION OF 15
= 1074 arctan 1 + 1257 arctan 1 + 1731 arctan 1 +
4
4246
5357
6107
1
1
1
+295 arctan 12943 + 625 arctan 19703 481 arctan 32807
1 + 398 arctan 1
1042 arctan 39307
390112
(2.16)
= 7162 arctan 1 + 3796 arctan 1 + 2558 arctan 1 +
4
12943
32807
34208
1
1
1
+2729 arctan 44179 708 arctan 51387 + 2192 arctan 114669
1
1
1
2805 arctan 157318
3696 arctan 485298
2407 arctan 24208144
(2.17)
= 2805 arctan 1 398 arctan 1 + 1950 arctan 1 +
4
5257
9466
12943
1
1
1 +
+1850 arctan 34208 + 2021 arctan 44179 + 2097 arctan 85353
1 + 1389 arctan 1 + 808 arctan 1
+1484 arctan 114669
330182
485298
(2.18)
= 50539 arctan 1 + 1555 arctan 1
4
51387
114669
1
1
1
6601 arctan 157318 20678 arctan 390112
5617 arctan 485298
1 + 10958 arctan 1
1
64126 arctan 617427
30569
arctan
1984933
3449051
1
1
+23407 arctan 22709274 + 25433 arctan 24208144
(2.19)
= 36462 arctan 1 + 135908 arctan 1
4
390112
485298
1
1
+274509 arctan 683982 39581 arctan 1984933
1
1
+178477 arctan 2478328
114569 arctan 3449051
1 + 61914 arctan 1
146571 arctan 18975991
22709274
1
1
69044 arctan 24208144 89431 arctan 201229582
1
43938 arctan 2189376182
(2.20)
= 446879 arctan 1 + 172370 arctan 1
4
683982
1635786
1
1
193720 arctan 1984933 + 369078 arctan 2478328
1 + 21339 arctan 1
+18231 arctan 3014557
3449051
(2.21)
f...g
f...g
f5,13,17,29,37,41,53,61g (Gauss)
f...g
f5,13,17,29,37,53,61,89,97,101g
CHAPTER 2. REMARKS ON THE COMPUTATION OF 16
1
1
154139 arctan 6225244
110109 arctan 18975991
1
1
+80145 arctan 22709274
223183 arctan 24208144
1
1
107662 arctan 201229582
216308 arctan 2189376182
f...g
= 872408 arctan 1 + 619249 arctan 1
4
1984933
2298668
1
1
+369078 arctan 2478328 + 18231 arctan 3014557
1 + 911989 arctan 1
1217159 arctan 5033696
6225244
1
1
+783649 arctan 18975991 70886 arctan 22709274
1
1
374214 arctan 24208144
1044789 arctan 168623905
1
1
+339217 arctan 201229582
446879 arctan 284862638
1
+402941 arctan 2189376182
(2.22)
f...g
2.2 How to build arctan formulas
For a n-term arctan relation of the form
k = m arctan 1 + m arctan 1 + ::: + m arctan 1
1
2
n
4
a1
a2
an
(2.23)
1. Choose a set F = fp1; :::; pn 1g of primes of the form 4k + 1
2. Find a1 ; :::ay so thate a2i +e1 factor completely
in 2 [ F,
i.e. a2i + 1 = 2e p1 p2 ::: pen 1
i = 1; 2; :::; y
(the factor 2 for the odd xi is ignored in what follows).
3. If you can't nd more than n ai , i.e. y < n, then restart with another F
4. give the ei;j a minus sign if (ai %pj ) > p2
5. Find the nullspace of the (n 1) y matrix Mij := feij g
6. Find linear combinations of the basis vectors of the nullspace that correspond to nice and nontrivial
(i.e. k 6= 0) arctan relations.
i;0
i;1
i;2
i;n
1
j
An example: for a 5-term relation
1. Choose F = f5; 13; 61; 101g
CHAPTER 2. REMARKS ON THE COMPUTATION OF 17
2. Find f2; 3; 5; 7; 8;18; :::;57; :::;111; 239; 515;682; 12943g
(from which i choose the 5 largest 111; 239; 515;682; 12943)
3. y >= 5 ok.
4. and
5. M =
5 13 61 101
111 0 0 -1 +1
239 0 +4 0
0
515 0 -1 0
2
682 +3 0 +2
0
12943 -4 -3 +1
0
(e.g. 2392 + 1 = 2 134 and 239%13 = 5 < 13=2)
6. we were lucky:
1 = 88 arctan 1 + 7 arctan 1 44 arctan 1 +
4
111
239
515
1
1
+32 arctan 682 + 24 arctan 12943
Often one ends up with a trivial relation, i.e.
0 = m1 arctan a1 + m2 arctan a1 + ::: + mn arctan a1
1
2
n
(2.24)
(2.25)
To build formulas with terms of the type arctan ab use the factors of a2 + b2 .
Open questions:
1. What is the upper bound for the ai for a certain set of factors F ?
2. Is there an algorithm that (in subexponential running time) nds for a certain set A = fai g; i =
1; :::; y (for which a2i + 1 factor completely in F) the arctan relations also for the subsets of A that
contain only ai for which a2i + 1 factor completely in a subset of ?
3. Is there a better algorithm to nd the ai for a certain F than these:
Q
(a) tree search over all products pej
(checking for each product if the product minus one is square)
(b) brute force checking all a = 2:::1 if a2 + 1 factors in F
ij
2.3 Ramanujan type formulas
Some nice explicit `Ramanujan-type' formulas for 1= follow. For more formulas and explanation cf. [15]
and [17] but don't see appendix A.
The explicit formulas were made in 1994 using Mathematica (for numerical computation of the quantities
in the general formulas and for nding the minimal polynomials) and MapleV (for solving the polynomials
and numerical verication of the results).
CHAPTER 2. REMARKS ON THE COMPUTATION OF 18
The `huge' formulas here are given rather for fun than for the computation of pi.
The `type X' are the same as in [17].
It is
(z)k := z k := z(z + 1)(z + 2):::(z + k 1)
(2.26)
in what follows.
2.3.1 Type 1 n = 58
1 1
2
3 1
1 = X
4 n 4 n 4 n 2 p2 (1103 + 26390 n)
3
n!
(992 )2n+1
n=0
p X
8 1 (4n)! (1103 + n 26390)
= 9801
(n!)4 3964n
n=0
(2.27)
(2.28)
(Ramanujan) about 8 correct digits per term
2.3.2 Type 1 n = 862
1
1 = X
n=0
1
2
3
4 n 4 n 4 n
n!3
A+ nB
X 2n+1
(2.29)
(type 1, n = 862)
A :=
h
4521962731044058367634998271455136035=4+
(2.30)
p
+799377627848523458605912125112563234
2+
+12 17750127552909235203012377369182079345275390781190873870656491261057219+
p 1=2i1=2
+1255123555958829884236839904476079251826408616374387198187634303258534 2
B :=
h
9617761395088953485915444091307636106000+
(2.31)
p
+6800784302301588686616253973429782154400
2
p
+52003425600 2 34204566586722903151731072537516469136640672047198830592963+
p 1=2 i1=2
+24186280981018566606552309811255775851849456510216830399522 2
p
X := 1670141896514232075+
1180968660568974600 2 +
p
+2736 2 372627201865017746341791564603+
p 1=2
+263487221293322577155951514850 2
(each term adds 37 digits)
(2.32)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 19
2.3.3 Type 2 n = 37
1
1 = X
( 1)n
n=0
2
3
1
4 n 4 n 4 n
n!3
(1123 + 21460 n) 1
4
8822n+1
(2.33)
(Ramanujan)
2.3.4 Type 3a n = 7:::163
1 1
3
5
X
1 = p 1
6 n 6 n 6 n A +nB
n!3
Jn
1728 J n=0
1
X
A+nB
1
(6n)!
p
=
1728 J n=0 123n (3n)! (n!)3 J n
(2.34)
(2.35)
n
A
B
J correct digits per term
7
24
189 -125/64
1
11
60
616 -512/27
1
19
300
4104
-512
3
27
1116
18216 -64000/9
4
43
9468
195048
-803
6
67
122124
3140242
-4403
8
163 163096908 6541681608 -533603
15
The last (n = 163) is known as Chudnovsky's formula:
1 13591409
1 = 6541681608 X
(6k)!
( 1)k
+
k
p
3
3
(k!) (3k)! 6403203k
640320 k=0 545140134
1
X
12
13591409 + k 545140134
= p
( 1)k (k!)(6k)!
3
3 (3k)!
(640320)3k
640320 k=0
(2.36)
(2.37)
2.3.5 Type 3c n = 1555
1 1
3
5
1 = p 1 X
6 n 6 n 6 n A+ nB
n!3
Jn
12 J n=0
1
X
(6n)!
A +nB
= p 1
n
3
12 J n=0 12 (3n)! (n!) J n
(2.38)
(2.39)
(type 3c, n = 1555)
p
A := 5280419026080999965452185+ 2361475178400070170568800 5 +
p
+32 5 10891728551171178200467436212395209160385656017+
p
+4870929086578810225077338534541688721351255040 5 1=2
(2.40)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 20
p
B := 654159204458052267524145750+
292548889855077669080467200 5 +
p +209664 3110 6260208323789001636993322654444020882161+
(2.41)
p 1=2
+2799650273060444296577206890718825190235 5
J :=
h
p
17897749588626020+ 8004116944887336 5 +
p
+108 5 10985234579463550323713318473+
p i3
+4912746253692362754607395912 5 1=2
(2.42)
(each term adds 50 correct digits)
0 = 91056965337194438815073158624225+
+9214187265360390391808927003100 A +
+672035320036821921804675631270A2
21121676104323999861808740A3 + A4
(2.43)
0 = 17514180018137387326565131389045795600+
+193756947585743300725193322013380000 B +
+2063419786805410130433556462222680B 2
2616636817832209070096583000 B 3 + B 4
(2.44)
0 = 27192565672854630400+
+49698245345181030400 U +
+22885453089727782720 U 2
71590998354504080 U 3 + U 4
(2.45)
U3
J =
(2.46)
2.3.6 Type 3b n = 190
1
1 = p1 X
3J n=0
1
3
5
6 n 6 n 6 n
n!3
A+ nB
Jn
(2.47)
A := 21242668516504965+
p
+15020834958518500
2+
p
+2 5 45125096427586568251645610141659+
(2.48)
(type 3b, n = 190)
p 1=2
+31908261685643312902173585434250 2
B := 1839779353703421900+
(2.49)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 21
p
+1300920456890691000
2+
p +24337404 10 1142912476713024496667+
p 1=2
+808161162586491705750 2
J :=
h
p
71864175655+ 22725423252 10 +
(2.50)
0 = 18983882886895192207942622025
2233154457185835655186373700A +
+5704998902295029443240990 A2
84970674066019860 A3 + A4
(2.51)
0 = 11316047287507303785105891917318400
143564046791790430632439232928000 B +
+21396235898865291113024998560 B 2
7359117414813687600B 3 + B 4
(2.52)
0 = 1860185517864501025 1262383694834359900U +
+44498697145120230 U 2 287456702620 U 3 + U 4
(2.53)
p p 1=2 i3
+2808 5 261993316778681+ 82849561276216 10
(each term adds 34 digits)
J =
U3
(2.54)
2.4 How to build Ramanujan type formulas
Here is how to build `Ramanujan-type' formulas like those in section 2.3:
1. Read the denitions of the general formulas.
2. Pick out the necessary denitions from the messy appendix A or from Borwein's book ([15]).
3. Write a mupad-package that implements all the needed quantities (steal from the mathematica
package src/pi/bucket/piram.m).
4. For each formula and n do
(a) Get numeric approximations for the quantities you need (e.g. fn and Jn), compute 500 digits
or so.
(b) Find the minimal polynomials for those quantities.
(c) Solve the polynomials & beautify the results.
(d) Check the symbolic results by comparing them to the quantities they were made of, using a
higher precision than before.
For more formulas and explanation cf. [17] and [15].
CHAPTER 2. REMARKS ON THE COMPUTATION OF 22
2.5 Approximations for In what follows (n) denotes an n digit approximation for .
(2) = 22
7 = 3:1428:::
355 = 3:14159292:::
(6) = 113
(2.55)
(2.56)
The last approximation tells us that it is a particularly bad idea to use as an irrational value e.g. in
chaos theoretic programs: it is almost
p5 1up to oating point (single-) precision a rational number with
pretty small denominator. Use = 2 instead, cf. section C.
(2) =
p
p
3 + 2 = 3:1462:::
(2.57)
Ramanujan [28] gives in his paper (among many other):
p (5) = p12 log 2 + 2
(2.58)
22
p p p
(15) = p12 log 12 2 5 + 2
13 + 3
(2.59)
130 q
q
p
p
(16) = p24 log 12 7 2 + 10 + 11 2 + 10
(2.60)
142
p p p
(18) = p12 log
10 + 3 2 2 + 10
(2.61)
190 p p p q p
(22) = p12 log
2+2
5 + 3 2 10 + 20 10 + 61 + 5
(2.62)
310
!
3 p p q p
p p
p qp 6
1
4
3 6+5+ 3 6+3
(2.63)
(31) = p log 256 2 29 + 5 11 6 + 5 29
522
From the denition of the J-function
J() := 1=q + 744 + 196884 q + 21493760 q2 + 864299970 q3 + 20245856256 q4 +
(2.64)
5
6
7
8
+ 333202640600 q + 4252023300096q + 44656994071935q + 401490886656000 q +
+ 3176440229784420 q9 + 22567393309593600q10 + :::
(where q := e2 i ) it is possible to give approximations to for certain values of (cf. [11]).
E.g.
3 + 744
log 5280
p
(17) =
(2.65)
67
3 + 744
log
640320
p
(30) =
(2.66)
163
for = 67 and = 163, respectively.
As q is close to an integer for these values, one can take more terms from the abovep series to get
(approximating q by [q]) better approximations of the same type. With z := J( 1+i 2 163 ) + 744 =
CHAPTER 2. REMARKS ON THE COMPUTATION OF 23
6403203 + 744 one gets
(46) = log(z p196884=z)
(2.67)
163
log z 196884=z + 21493760=z 2
p
(60) =
(2.68)
163
Using more terms doesn't improve the accuracy anymore because of the approximation made for q.
2.6 Iterations
For general forms of the examples given here see J. & P. Borwein's book [15] and their papers.
For some iterations an operation count (in units of full precision multiplications) is given. Operations
dierent from multiplication are counted as follows:
1 squaring = 2/3 mult.
1 division = 4 mult.
1 inverse sqrt = 4 mult.
1 sqrt = 5 mult.
1 cuberoot = mult.
1 inverse 4th root = mult.
1 4th root = mult.
full prec mult ! eciency measure
2.order iteration, cf. src/pi/pi2nd.cc:
y0 = p1
2
1
a0 = 2
(1 yk2 )1=2 ! 0 +
yk+1 = 11 + (1
yk2 )1=2
yk2 ) 1=2 1
= (1
(1 yk2 ) 1=2 + 1
ak+1 = ak (1 + yk+1 )2 2k+1 yk+1 ! 1
ak 1 16 2k+1 e 2 2.72 shows how to save 1 multiplication per step (cf. section 1.4).
Operations per step: 1 inverse sqrt, 1 division, 2 squarings, 1 multiplication.
k+1
Quartic (4.order) iterations, cf. src/pi/pi4th.cc:
variant r = 4:
p
y0 = 2 1
p
a0 = 6 4 2
yk4 )1=4 ! 0 +
yk+1 = 11 + (1
(1 yk4 )1=4
yk4 ) 1=4 1
= (1
(1 yk4 ) 1=4 + 1
(2.69)
(2.70)
(2.71)
(2.72)
(2.73)
(2.74)
(2.75)
(2.76)
(2.77)
(2.78)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 24
ak+1 = ak (1 + yk+1 )4 22k+3 yk+1 (1 + yk+1 + yk2+1 ) ! 1
= ak ((1 + yk+1 )2 )2 22k+3 yk+1 ((1 + yk+1 )2 yk+1 )
0 < ak 1 16 4n 2 e 4 2 Identities 2.78 and 2.80 show how to save operations.
Operations per step: 1 inverse 4th root, 1 division, 2 squarings, 1 multiplication.
variant r = 16:
1=4
y0 = 11 + 22 1=4
p
8=
a0 = (2 1=42+ 1)2 4
n
(2.79)
(2.80)
(2.81)
(2.82)
(2.83)
yk4 ) 1=4 1 ! 0 +
(2.84)
yk+1 = (1
(1 yk4 ) 1=4 + 1
ak+1 = ak (1 + yk+1 )4 22k+4 yk+1 (1 + yk+1 + yk2+1 ) ! 1
(2.85)
0 < ak 1 16 4n 4 e 4 4 (2.86)
Same operation count as last, but this variant gives approximately twice as much precision after the same
number of steps.
n
AGM (2.order) iteration, cf.1.48 :
ak+1 = ak +2 bk
p
bk+1 = ak bk
c2k = a2k b2k
= (ak 1 ak )2
Operations: 1 multiplication, 1 sqrt, 1 squaring.
AGM variant 1, cf.
:
a0 = 1
b0 = p1
2
2 a2n+1
pn = 1 P
n 2k c2
(2.87)
(2.88)
(2.89)
(2.90)
src/pi/piagm.cc
k=0
k
(2.91)
(2.92)
!
2 2n+4 e 2
pn = AGM
2(a0 ; b0)
A 4.order version uses 1.50, cf. also src/pi/piagm.cc.
AGM variant 3fast, cf.
:
= 1
n+1
(2.93)
(2.94)
src/pi/piagm3.cc
a0
p
p
b0 = 6 +4 2
2 a2n+1
pn = p
P
n 2k c2 ) 1 ! 3 (1
p 2 n+4k=0p3 2k
2 e
pn < 3 AGM
2(a0 ; b0)
n+1
(2.95)
(2.96)
(2.97)
(2.98)
CHAPTER 2. REMARKS ON THE COMPUTATION OF AGM variant 3slow, cf.
25
:
src/pi/piagm3.cc
a0 = 1
b0 =
p
6
p
4
(2.99)
2
(2.100)
6 a2n+1
pn = p
P
n 2k c2 ) + 1 ! 3 (1
k=0
k
p13 2 2n+4 e p 2
pn <
AGM(a0 ; b0)2
1
3
Derived AGM iteration (2.order), cf.
(k 0) ! 1 +
yk pxk + p1x
=
(k 1) ! 1 +
yk + 1
+ 1 (k 1) ! +
= pk xy k +
1
k
pk = 10
Cubic AGM, from [22], cf.
(2.102)
:
p
k
pk+1
n+1
src/pi/pideriv.cc
x0 = 2
p
p0 = 2 + 2
y1 = 21=4
xk+1 = 12 pxk + p1x
yk+1
(2.101)
k
2k+1
src/pi/picubagm.cc
(2.107)
(2.108)
(2.109)
:
a0 = 1p
b0 = 32 1
an+1 = an +3 2 bn
r 2
2
bn+1 = bn (an + a3n bn + bn)
2
n
pn = 1 Pn 33ka(a
2 a2 )
k=0
k
k+1
(2.110)
(2.111)
(2.112)
(2.113)
3
Quintic (5. order) iteration, from the article [18] cf.
p
(2.103)
(2.104)
(2.105)
(2.106)
src/pi/pi5th.cc
s0 = 5( 5 2)
a0 = 12
sn+1 = s (z + 25
x=z + 1)2 ! 1
n
where x = s5 1 ! 4
n
and y = (x 1)2 + 7 ! 16
(2.114)
:
(2.115)
(2.116)
(2.117)
(2.118)
(2.119)
CHAPTER 2. REMARKS ON THE COMPUTATION OF x 1=5
p
2
3
!2
2 y + y 4x
2 5 p
s
1
n
2
n
2
an+1 = sn an 5
2 + sn (sn 2sn + 5) ! an 1 < 16 5n e 5
and z =
n
26
(2.120)
(2.121)
(2.122)
Btw. the 5th order algorithm is the slowest of the above, because compared to the other iterations much
more operations are needed for each step.
Cubic (3. order) iteration, from [25], cf.
:
src/pi/pi3rd.cc
a0 = 13
p
s0 = 32 1
rk+1 =
sk+1
ak+1
(2.123)
(2.124)
3
1 + 2 (1 s3k )1=3
= rk+12 1
= rk2+1 ak 3k (rk2+1 1) ! 1
Nonic (9. order) iteration, from [25], cf.
src/pi/pi9th.cc
(2.125)
(2.126)
(2.127)
:
a0 = 13
p
r0 = 32 1
s0 = (1 r03)1=3
t = 1 + 2 rk
u = 9 rk (1 + rk + rk2 ) 1=3
v = t2 + t u + u2
2
m = 27 (1 + vsk + sk )
ak+1 = m ak + 32 k 1 (1 m) ! 1
k )3
sk+1 = (t(1+ 2ru)
v
3
1
=
rk+1 = (1 sk ) 3
(2.128)
(2.129)
(2.130)
(2.131)
(2.132)
(2.133)
(2.134)
(2.135)
(2.136)
(2.137)
2.7 How to build iterations
See Borwein's book [15] and their papers (in particular [49]), enjoy !
E.g. learn that the general form of the quartic iterations (2.75 and 2.82) is2
y0 =
2
[15], p.170f
p
(r)
(2.138)
CHAPTER 2. REMARKS ON THE COMPUTATION OF a0 = (r)
(1 yk4 ) 1=4 1 ! 0 +
yk+1 = (1
yk4 ) 1=4 + 1
p
ak+1 = ak (1 + yk+1 )4 22k+2 r yk (1 + yk+1 + yk2+1) ! 1
p
p
0 < ak 1 16 4n r e 4 r n
27
(2.139)
2.8 Geometric iterations for Let rk and Rk be the radii of a circles that are inscribed and circumscribed, respectively, to a regular
polygon with 2k sides and circumference 2. Then 2 rk < 2 < 2 Rk and the relations
r2 = 14
(2.140)
R2 = p1
(2.141)
8
rk+1 = Rk 2+ rk
(2.142)
p
Rk+1 = Rk rk+1
(2.143)
allow to compute better and better approximations to . This is called Cusanus' method, it was discovered
around 1450, cf. [60] pp.155-156. Note the dierent subscripts on the right hand side of the last equation:
if they were equal the above iteration would compute the AGM(r2; R2).
Archimedes used the circumferences of regular polygons with 3 2k that are inscribed (sk ) and circumscribed (tk ) the unit circle.
p
t0 = 2 3
(2.144)
s0 = 3
(2.145)
(2.146)
tk+1 = t2 t+k ssk
k
k
p
sk+1 = tk+1 sk
(2.147)
This is also called the Borchard-Pfa algorithm. Again, if the subscipts on the right hand side of the last
equation were the same then one would compute the arithmetic-harmonic mean AHM(a0 ; b0) that also
has the quadratic convergence property of the AGM. One can identify equation 2.146 as
2 tan sin tan 2 = tan
(2.148)
+ sin and equation 2.147 as
r
sin 2 = tan 2 sin (2.149)
The quantities in the above algorithms can be identied with (values of) trigonometrical functions and
their half-argument relations.
It is easy to contruct one-valued iterations of similar kind. Consider 4 2k -sided regular polygons circumscribed around the unit circle. The cicumference is used as an approximation for that of the circle:
2 8 2k xk where xk is the length of one side of the 4 2k -gons. One has
xk = tan x2k0
(2.150)
CHAPTER 2. REMARKS ON THE COMPUTATION OF Start with the quadrat (x0 = 1) and use
tan 2 =
i.e. iterate
xk+1 =
28
ptan (2.151)
pxk
1 + 1 + x2k
(2.152)
1 + 1 + tan2 This can be rewritten in many ways, this one is quite elegant: use
arctan x1 = 2 arctan p1 2
x+ x +1
i.e. iterate
q
k+1 = k + 2k + 1
(2.153)
(2.154)
The approximation made in these algorithms is always pof the type sin or tan .
Note that all these iterations converge only linear.
Cf. [3] and [66].
2.9 Products for Wallis product
= 2 2 4 4 6 6 8 8 :::
2
13 35 57 79
1 4n2
Y
=
4n2 1
(2.155)
n=1
From
sin 2 x = 2 sin x cos x
(2.156)
sin2 x = sin x cos x
2x
x
(2.157)
1
sin x = Y
cos 2xn
x
n=1
(2.158)
or equivalent
follows by repeated substitution
using
cos x2 =
r
1 + cos x
2
p22 + 2 cos
x
=
2
(2.159)
(2.160)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 29
and x = 2 one gets
s
u
r v
r
u
2 = 1 1 + 1 1 t 1 + 1 + 1 1 :::
2 2 2 2 2
2 2 2
q
p
p
p p p
(2.161)
2 2 + 2 2 + 2 + 2 :::
2 2 2
(2.162)
1
tan x = Y
1
x
x
n=1 1 tan 2
(2.163)
cos x = sinx x = tanx
x
(2.164)
r s
=
From
n
and
and formula 2.158 follows
1 "
Y
k=0
R.W.Gosper gave
1 "
Y
and
k=0
1 sin x = Y
2 x 2
1
tan
n
x
2
n=1
2 (k 12 ) (k+2)
27 (k+ 32 ) (k+ 43 )
10
1
0
(k 52 ) (k+ 32 ) (k+3) (k+ 27 )
64 (k+ 34 ) (k+ 54 ) (k+ 94 ) (k+ 114 )
1 "
Y
k=0
=
) (k
) (k
19
6
7
12
) (k+1) (k+ 196 ) (k+ 256 )
37
) (k+ 32 ) (k+ 31
12 ) (k + 12 )
13
6
1
12
6175 2268
:
0
325
378
:
:
(2.165)
0 +6 = 0 1
48 (k + 41
21 )
1
0
(k
64 (k
#
1
n
#
=
(2.166)
0 15 + 32 0
1
23 ) (k + 1 ) (k + 11 )
42
3
6
(k
1
#
(2.167)
(2.168)
Gosper gives two matrix products for arctan(x) (and thereby for ): Dene
K(k; n) :=
"
and
N(k; n) :=
then
k x2
(n+k)(x2+1)
0
n x2
n+k
0
x
x +1
#
2
1
x
1
arctan(x) = upper-right K(1; 21 ) K(2; 12 ) K(3; 21 ) K(4; 12 ) :::
= upper-right N(1; 12 ) N(1; 32 ) N(1; 52 ) N(1; 27 ) :::
(2.169)
(2.170)
(2.171)
(2.172)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 30
2.10 Continued fractions for 2.10.1 The simple continued fraction for = 3+
1
7+
15 +
1+
1
292 +
1
(2.173)
1
1
1 + 1 +1 :::
there is no pattern in the occuring numbers, in gure 2.1 (page 35) the rst 500 terms are given.
2.10.2 other continued fractions for 4
= 1+ 2+
(Brouncker, 1658)
12
32
52
2+
72
2+
2
2 + 9 112
2 + 2 + :::
(2.174)
12
22
32
5+
42
7+
2
9 + 11 5+ :::
(2.175)
4
= 1+ 3+
(cf. [59])
2
6
6 = 1+ 1+
12
12
22
1+
23
1+
32
1+
1 + 3 442
1 + 1 + :::
12
2 = 1 + 3 +
14
24
34
5+
4
7 + 4 54
9 + +:::
(2.176)
(2.177)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 31
rk =k = 1 + 1k =(3 + 2k =(:::))
2.11 Series for = arctan 1
4
1 + 1 + :::
= 1 13 + 15 17 + 19 11
13
(Gregory, 1671). The error of the truncated series is about one half of the rst neglected term.
Applying the Euler transform (cf. [53] p.253-255) to 2.178 gives the series
= 1 + 1 + 1 2 + 1 2 3 + :::
2
3 3 5 3 5 7
= 1 + 13 1 + 52 1 + 37 (1 + :::)
(2.178)
(2.179)
(2.180)
(2.181)
which is used in the spigot algorithm, cf. [12].
In [1] the following acceleration of the arctan-series is given:
1 2x2 k+1
x2k+1 + ( 1)n 1 x2n 1 X
k!
( 1)k 2k
2+1
+
1
2
x
((2n
+
1))k+1 (2.182)
k=0
k=0
where ((2n + 1))k+1 denotes (2n + 1)(2n + 3):::(2n + 2k + 1). The error of the truncated series is less
than j1 + xj times the rst neglected term.
For x = 1 (formula 2.178) and n = 500 this is
= 1 1 + 1 +::: 1 +
(2.183)
4
3 5
999
1 +
1!
2!
3!
+
+
+ 21 1001
1001 1003 1001 1003 1005 1001 1003 1005 1007 + :::
arctan x =
nX1
= arcsin 1
(2.184)
6
2
= 12 + 12 3 123 + 12 34 5 125 + 21 34 56 7 127 + 21 43 65 87 9 129 + ::: (2.185)
(Newton, 1665)
= 3+ 1
4
4 234
1
1
456 + 678
1
1
8 9 10 + 10 11 12 +:::
(2.186)
4 = 1 + 1 + 1 1 2 + 1 1 3 3 + 1 1 3 5 4 + :::
4
24
246
2468
(2.187)
4 = 1 + 1 + 1 1 2 + 1 1 3 2 + 1 1 3 5 2 + :::
2 2 2
2 24
2 246
(2.188)
(Gauss)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 3
2 = 1 5 1
2
(Ramanujan, cf. p.7 in [67])
1 3 3
+9 24
32
1 3 5 3
13 2 4 6
+ :::
(2.189)
1 (n!)2
p X
= 3 3
(2.190)
n=1 (2n)! n
1
p X
1
(3n
+
1)
(3n + 2)
n=0
= 3 3
Using the identity
(2.191)
1 1 4
X
2
1
1
=
i
i=0 16 8i + 1 8i + 4 8i + 5 8i + 6
(2.192)
it is possible to compute some hexadecimal digits of without computing any of the preceding digits.
See the article [42] for the algorithm.
A similar series is
1 ( 1)i 2
X
2
1
(2.193)
=
i
4i + 1 + 4i + 2 + 4i + 3
i=0 4
1 8 + 2 3 13 + 3 5
47
= 3 + 60
783
10 11 3 18 + 13 14 3 (23 + :::)
(Gosper, cf. [?])
1 ( 1)n+1
X
Pn k2 = 6 ( 3)
n=1
k=1
(from [15], p.101)
F.Bellard gives
740025 + 20379280 =
where
P(n) :=
1 3 P(n)
X
7n n 1
n=1 2 n 2
885673181 n5 + 3125347237 n4 2942969225 n3
+1031962795 n2 196882274 n + 10996648
12
= log x1 2 x4 13 x8 368
3 x :::
1=4
where x = 12 221=4 + 11
(2.194)
(2.195)
(2.196)
(2.197)
(2.198)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 33
2.12 Miscellaneous formulas for p 1
=
e
(Euler)
In [2] integrals of the form
In;m =
examples are
I4;4 =
1
Z 1 xm (1 x)n
0
(1 + x2)
Z 1 x4 (1 x)4 22
= 7 0 (1 + x2 )
(2.199)
(2.200)
(2.201)
I2;4 = 47
(2.202)
15
I6;12 = 16 153966181
(2.203)
3063060
(2.204)
I32;32 = 16384 316945148388686672766347599664
6157640021368865976621675
The fractions on the rhs. are, as shown in the paper, approximations for , the last gives 23 correct digits.
p
10005
= 13591409 F ( 1 ; 1 ; 426880
5
;
1;
1;
A)
B 3 F2( 76 ; 23 ; 116 ; 2; 2; A)
3 2 6 2 6
where
A :=
1
151931373056000
30285563
B := 1651969144908540723200
(2.205)
(2.206)
(2.207)
(2.208)
(Chudnovskys), this is from [45].
The
From the Poisson summation formula (cf. [46]) follows:
+1 X
sin x = x= 1 x
+
X1 sin x 2
= x
+
X1 sin x 3
= 43 x
x= 1
+
X1 sin x 4
= 23 x
x= 1
x= 1
(cf. appendix ??).
(2.209)
(2.210)
(2.211)
(2.212)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 34
2.13 A bit recursion for 1=
a0 := tan(1)
ak+1 := 12 aak 2
1 kif x < 0
b(x) :=
0 else
(2.213)
(2.214)
(2.215)
then
1 b(a )
X
k
1
k+1 = 2
k=0
1 b(a )
X
k
arctan(a0)
k+1 =
2
k=0
(2.216)
(2.217)
See and the paper [51].
2.14 A self correcting iteration for Use
therefor the iteration dened by
sin 2 = 0
(2.218)
x0 = 2 + 0
xk+1 = xk + sin xk
(2.219)
(2.220)
converges towards .
Convergence is of third order: if xk = 2 + k then
3
k+1 6k
Of course, this is not an `ecient' iteration as the computation of a sine function is required.
Similar iterations exist for cos() and tan(), see [57].
(2.221)
CHAPTER 2. REMARKS ON THE COMPUTATION OF 3
7
3
1
1
84
2
6
1
1
1
2
1
8
2
2
45
1
24
1
2
5
2
26
1
7
7
2
1
2
3
3
15
1
1
1
1
1
2
1
3
1
1
2
6
4
1
1
1
1
1
1
1
2
7
1
4
1
4
3
5
20
2
2
1
3
5
4
11
24
1
1
1
58
2
7
2
1
1
1
2
1
4
10
34
1
4 20776
1
7
1
3
1
1
1
4
2
5
5
43
15
14
2
6
6
1
1
3
22
2
4
1
3
3
18
3
2
3
1
6
23
1
127
1
29
1
1
1
48
1
1
1
6
6
4
1
5
1
1
1
13
5
1
1
2
1
1
6
2
1
1
2
1
99
8
1
1
1
1
1
1
4
3
1
1
1
13
3
1
1
1
21
14
1
3
3
12
2
16
2
1
1
11
9
4
4
1
15
1
1
1
12
1
1
1
1
3
3
2
4
292
1
1
1
1
12
2
2
2
3
2
1
1
57
3
2
1
28
4
4
15
2
5
1
1
1
1
1
1
3
5
1
4
1
5
3
2
1
3
9
1
3
4
1
94
32
50
1
2
3
1
1
15
2
7
1
1
4
2
1
2
1
1
1
7
8
2
1
1
1
1
1
1
5
1
1
4
11
4
1
4
1
3
5
2
2
1
4
1
1
1
3
15
1
55
5
2
3
28
5
1
2
3
2
1
1
6
4
1
2
8
8
7
18
30
1
1
10
1
120
3
1
3
4
2
10
1
3
5
2
1
1
1
1
1
2
2
8
1
4
3
21
1
1
1
1
16
3
1
3
35
1
2
13
6
2
1
1
16
4
1
1
2
2
1
1
1
4
3
1
2
7
2
13
1
2
3
1
1
2
2
436
5
1
5
4
1
1
1
1
3
24
1
4
1
1
14
5
1
1
1
2
2
1
3
3
3
1
1
1
1
5
42
4
9
1
2
1
2
5
1
1
9
7
1
1
1
1
7
1
1
8
1
1
15
1
1
1
1
2
15
1
2
44
1
2
1
1
2
13
4
1
2
4
5
7
1
5
161
2
10
2
2
9
19
1
1
12
20
3
1
16
1
9
3
3
3
1
1
1
2
1
2
2
1
6
2
2
4
1
1
2
1
1
23
1
1
2
2
1
1
Figure 2.1: The rst 500 terms of the simple continued fraction of . The third term (15) corresponds
355 .
to the approximation 227 , the fth term (292) corresponds to 113
Appendix A
How to build Ramanujan type
formulas
NOTE: this section may be detrimental to your health, do not read it.
2 K 2
(k)
1. Series in xN N 3:
= m(k) F((k))
2!
12
12
= 1 +1 k2 3F2 14 ; 34 ; 12 ; 1; 1; g +2 g
G12 G
1
1
3
1
= k02 k2 3 F2 4 ; 4 ; 2 ; 1; 1;
2
= p 1 2 02 3 F2 61 ; 56 ; 12 ; 1; 1; J 1
1 k k
12
2!
1 1
2
3
1 = X
4 n 4 n 4 n d (N) x2n+1
n
N
n!3
n=0
g12 + g 12 1
N
N
xN :=
2
02
= 4 k(N)2k (N)2
(1 + k (N))
! p 12 12 1 pN
(N)
x
12
N
dn := 1 + k2(N) 4 gN + n N gN 2 gN
2. Series in yN N 4:
1
1 2
1 = X
n
( 1) 4 n n!4 3n
n=0G12 G 12 1
N
N
yN :=
2
4 k(N) k0(N)
=
1 (2 k(N) k0(N))2
3
4 ne
2n+1
n (N) yN
(A.1)
(A.2)
(A.3)
(A.4)
(A.5)
(A.6)
(A.7)
(A.8)
(A.9)
(A.10)
(A.11)
36
APPENDIX A. HOW TO BUILD RAMANUJAN TYPE FORMULAS
en :=
37
!
12 (N) yN1 + N k2(N) G12 + n pN G12
N + GN
N
k02(N) k2(N) 2
2
p
3. Series in JN 1 N 2:
1 1 3 5
1 = X
6 n 6 n 6 n f (N) J 1=2 2n+1
n
N
n!3
n=0
27 G24
N
JN 1 :=
3
(4 G24
N 1)
27 gN24
=
(4 gN24 + 1)3
p q
p
+
fn := p1
N 1 GN24 + 2 (N) N k2(N) 4G24
1
N
3 3
q
p
+n N p2
8G24
+ 1 1 GN24
N
3 3
Elliptic integral of the rst kind:
1 (2 i 1)!! 2
X
K(k) := 2 2 F1 21 ; 12 ; 1; k2 = 2
k2i
i i!
2
i=0
Z1
Z =2
p 2 dt 2 2 =
p d
=
(1
t
)(1
k
t
)
1 k2 sin2 ()
0
0
= 2 AGM(1; k0)
= 2 23(q) q = e K 0 (k)=K (k)
Elliptic integral of the second kind:
1 1
1 (2 i 1)!! 2 k2i !
X
2
E(k) := 2 2 F1 2 ; 2 ; 1; k = 2 1
2i i!
2i 1
i=0
Z 1 p1 k2 t2 Z =2 p
p 2 dt =
=
1 k2 sin2 () d
1 t
0
0
Derivatives:
dK = E k02 K
dk
k k0
dE = E K
dk
k
Dierential equation for K and E:
2
dy + k y
0 = k3 k ddky2 + 3 k2 1 dk
( also satised by AGM(1; k) 1 and AGM(1 + k; 1 k) 1 )
p
k0 := 1 k2
K 0 (k) := K(k0 )
E 0(k) := E(k0 )
(A.12)
(A.13)
(A.14)
(A.15)
(A.16)
(A.17)
(A.18)
(A.19)
(A.20)
(A.21)
(A.22)
(A.23)
(A.24)
(A.25)
(A.26)
(A.27)
(A.28)
(A.29)
APPENDIX A. HOW TO BUILD RAMANUJAN TYPE FORMULAS
2 (q) :=
3 (q) :=
4 (q) :=
q=e
1
X
n= 1
1
X
n= 1
1
X
n= 1
38
q(n+1=2)
(A.30)
qn
(A.31)
2
2
( 1)n qn
2
22 (q)
k(q) := k = 2 (q)
3
2 (q)
k0 (q) := k0 = 24 (q)
3
0
K (k)
K (k)
E = k02 K + k k02 dK
dk
E 0 K + K 0 E K 0 K = 2
(A.32)
(A.33)
(A.34)
(A.35)
(A.36)
(A.37)
singular value function:
K 0 (k(N)) = pN k(N) := 2 (q) 2 ; where q := e pN
K
3 (q)
1
k(0) = 1; k(1) = p ; k(1) = 0 k(N) k(n)algebraic for N rational
2
2(r) 2
0
0
L
1
K
p
(l(N))
=
=
l(N)
:=
l(N) :
K p
L
3 (r) ; with
N
r := e = N = q1=N
K 0 = N L0
K
L
u := k1=4 v := l1=4
singular value function of the second kind:
0
(where k := k(N))
(N) := EK 4 K
2
p E0 N p E = N K 0 4 K 02 = 4 K 2
N K 1
k(N) :
=
recursions:
1
p
N 4 q _
pN )
(where
q
=
e
43
(1) = 12 ; (1) = 1
4
4
p
2 N k2 (N)
(4N) = 4 (N)
(1 + k0 (N))2 p
= 1 + y2 (4N) 2 Ny
(A.38)
(A.39)
(A.40)
(A.41)
(A.42)
(A.43)
(A.44)
(A.45)
(A.46)
(A.47)
(A.48)
(A.49)
APPENDIX A. HOW TO BUILD RAMANUJAN TYPE FORMULAS
where
39
0(N)
y := k(4N) = 11 + kk0(N)
(A.50)
p
(16N) = (1 + y)4 (N) 4 Ny(1 + y + y2 )
p
2
y := k(16N) = 1 p1 k2 (n)
1 + 1 k (n)
4
where
!2
4
(N
1)
=
p
N (N)
N
G,g:
G := (2k k0 ) 1=12 ; g := k2k02
recursions:
1=12
p G39n p G3n 1+2 2
1+2 2
G9n
G99n
p gn3 p g93n
9 = 1 + 2 2 g9 1 2 2 g9
9n
p n 3
2G
+
G
G381n = G9n p 93n n
p2Gn G93n
3
g81
g9n p2g93n + gn
n =
2gn g9n
J :=
=
=
=
4 G24 1 3
27 G24 4 g24 + 1 3
27 g24
4 1 k2 (N) + k4(N) 3
27 k4 (N) (1 k2 (N))2
4 1 k2 (N)k02(N) 3
27 k4(N)k04 (N)
j := 1728 J
multiplier:
(A.52)
(A.53)
9 =
(A.51)
(A.54)
(A.55)
(A.56)
(A.57)
(A.58)
(A.59)
(A.60)
(A.61)
(A.62)
(A.63)
2 (q)
K
3
MN (l; k) := 2 (q1=N ) = L
3
(A.64)
1 = pN k k02 4K K_ + (N) pN k2 4K 2
2
2
(A.65)
APPENDIX A. HOW TO BUILD RAMANUJAN TYPE FORMULAS
1 = pN k k02 4K_ + (N) pN k2 4K
K
1 (z; q) := 1 (z; t)
2 (z; q) := 2 (z; t)
3 (z; q) := 3 (z; t)
4 (z; q) := 4 (z; t)
:=
:=
:=
:=
where
2q1=4 sin z 2q9=4 sin 3z + 2q25=4 sin 5z 2q49=4 sin 7z + :::
2q1=4 cos z + 2q9=4 cos 3z + 2q25=4 cos 5z + 2q49=4 cos 7z + :::
1 + 2q cos 2z + 2q4 cos 4z + 2q9 cos 6z + 2q16 cos 8z + :::
1 2q cos 2z + 2q4 cos 4z 2q9 cos 6z + 2q16 cos 8z :::
q := eit
1 (z; q) := 1 (z; t) :=
2 (z; q) := 2 (z; t) :=
3 (z; q) := 3 (z; t) :=
4 (z; q) := 4 (z; t) :=
X
X
X
q((2n+1)=2) cos (2n + 1)z
(A.73)
q(2n) cos (2n)z
(A.74)
( 1)nq(2n) cos (2n)z
(A.75)
2
n2Z
X
2
n2Z
t
)
=
iM
2 (z + 2 ) = iM3 (z + 2 + t
4 (z + )
2
2
t
t
2 (z) = M3 (z + 2 ) = M4(z + 2 + 2 ) = 1 (z + 2 )
t )
)
=
M
(z
+
3 (z) = 4 (z + 2 ) = M1 (z + 2 + t
2
2
2
t
t
4 (z) =
iM1 (z + 2 ) = iM2 (z + 2 + 2 ) = 3 (z + 2 )
where M := q1=4eiz
1 (z)
=
1 (z) = 1 (z + )
2 (z) = 2 (z + )
3 (z) = 3 (z + )
4 (z) = 4 (z + )
= qe2iz 1 (z + t)
= +qe2iz 2 (z + t)
= +qe2iz 3 (z + t)
= qe2iz 4 (z + t)
@ 2 (z; t) = 4i @(z; t)
@z 2
@t
1
n
X
23 = 1 + 4 1 +q q2n
n=1
Let
T(x; q) :=
(A.67)
(A.68)
(A.69)
(A.70)
(A.71)
(A.72)
2
n2Z
(A.66)
( 1)nq((2n+1)=2) sin (2n + 1)z
2
n2Z
40
1
X
1
xn qn
2
(A.76)
(A.77)
(A.78)
(A.79)
(A.80)
(A.81)
(A.82)
(A.83)
(A.84)
(A.85)
(A.86)
(A.87)
APPENDIX A. HOW TO BUILD RAMANUJAN TYPE FORMULAS
then:
X
T (x; qa)T (y; qb ) =
xm yn qam +bn
2
m;n
a+X
b 1
=
k=0
2
Q1 :=
Q2 :=
Q3 :=
Q0Q1
Q0Q3
Q2Q3
Q1Q2
(1)nqkn +ln =
2
n= 1
=
=
=
=
1
Y
n=0
1
Y
n=1
1
Y
n=1
1
Y
n=1
1
Y
n=1
k = 3=2 and l = 1=2 gives:
n=1
triple-product identity:
1
Y
n=1
(1 qn) =
1
X
1
(A.90)
1 + q2n
(A.91)
1 + q2n
1
(A.92)
1 q2n
1
(A.93)
Q0 (q2)
Q0 (q1=2)
Q3 (q2)
Q1 (q1=2)
n=1
equivalent:
n= 1
n=1
(q) = 2q1=4Q
2
0Q1
( 1)nq(3n+1)n=2
(A.98)
(A.99)
(A.100)
(A.101)
(A.102)
(A.103)
1
X
n= 1
xn q n
2
(1 qn )(1 xqn)(1 x 1qn 1)(1 x2q2n 1)(1 x 2q2n 1)
1
X
1
Y
2
(1 q2n)(1 + xq2n 1)(1 + x 1q2n 1) =
1
Y
=
(A.94)
(A.95)
(A.96)
(A.97)
(1 q2kn+k l)(1 q2kn+k+l )(1 q2kn+2k)
quintuple-product identity:
(A.89)
1 q2n
e:g: :1 = Q1Q2 Q3
3 (q) = Q0 Q22
4 (q) = Q0 Q23
1
Y
(A.88)
2
yk qbk T (xyq2bk ; qa+b )T (ya x b q2abk; qab(a+b))
Q0 :=
1
X
41
(x3n x 3n 1)qn(3n+1)=2
(1 q2n)(1 xq2n 1)(1 x 1q2n 1)(1 x2q4n 4)(1 x 2q4n 4)
(A.104)
(A.105)
(A.106)
(A.107)
APPENDIX A. HOW TO BUILD RAMANUJAN TYPE FORMULAS
=
1
X
n= 1
q3n 2n[(x3n + x 3n) (x3n 2 + x (3n 2))]
2
42
(A.108)
Appendix B
More arctan formulas
In what follows let A x1 denote arctan x1 .
arctan x1 = arctan x +1 d + arctan 1x +1
x+ d
arctan x1 + arctan y1 = arctan x y1 1
x+y
2
arctan x1 + arctan x1 + ::: + arctan x1
1Q
2
n
n (x + i))
Re(
k
() z = Im(Qkn=1 (x + i))
k=1 Qk
n (x2 + 1)
k=1 k
() (z 2 + 1) =
Q
(Im( nk=1 (xk + i)))2
arctan 1z
arctan x1
arctan 1y + arctan 1z
2
2 + 1)
() (x2 + 1) = (y +(y1)(z
= (y x)(z x)
+ z)2
=
(B.2)
(B.3)
(B.4)
(B.5)
(B.6)
(B.7)
arctan ab1 + arctan ab2 + ::: + arctan abn
1
2
n
() (a1 + i b1 )(a2 + i b2 ):::(an + i bn )(1 i)k 2 R
(B.8)
(B.9)
arctan a1 + arctan a1 + ::: + arctan a1
1
2
n
() (a1 + i)(a2 + i):::(an + i)(1 i)k 2 R
(B.10)
(B.11)
m1 arctan a1 + m2 arctan a1 + ::: + mn arctan a1
1
2
n
m
m
m
k
() (a1 + i) (a2 + i) : : :(an + i) (1 i) 2 R
(B.12)
(B.13)
k
4
=
k
4
k
4
=
(B.1)
=
=
1
2
43
n
APPENDIX B. MORE ARCTAN FORMULAS
44
Let
a > b;
then
gcd(a; b) = 1; a + b = 1
(B.14)
A a1 b = A 1 + arctan a 1 b (B.15)
r := a b 1
1 + arctan 1
arctan z := arctan a=b
r
(B.16)
(B.17)
r 1
z = (a=b)
(a=b) + r
a) b
= a(b
a + b( b a)
a) b(1)
= a(b
a(1) + b( b a)
a) b( a + b)
= a(b
a(a + b) + b( b a)
a2 b2 = a
2 + b2
= (B.18)
because if
then
A x1 = A x +1 1 + A x2 +1x + 1
1
= A1 = X
A x2 +1x + 1 =
4
1
x=1
(B.19)
(B.20)
(B.21)
(B.22)
(B.23)
(B.24)
(B.25)
1 + A 1 + A 1 + A 1 + A 1 + :::
= A 13 + A 71 + A 13
21
31
43
57
1
1
1
A 2x + 1 = A 2x + 3 + A 2x2 + 4x + 2
1
= X
A 2n1 2
4
n=1
1 +A 1 +A 1 + A 1 + :::
= A 12 + A 81 + A 18
50
98
128
(B.26)
jt(a0 ; a1; m1; m2 ; 0) := a0
jt(a0 ; a1; m1; m2 ; 1) := a1
jt(a0 ; a1; m1; m2 ; n) := m1 jt(a0 ; a1; m1 ; m2; n 1) + m2 jt(a0 ; a1; m1 ; m2; n 2)
(B.30)
(B.31)
(B.32)
(B.27)
(B.28)
(B.29)
dene
then
APPENDIX B. MORE ARCTAN FORMULAS
jt(a0 ; a1; m1 ; m2; n) = C1 xn1 + C2 xn2 where:
x21;2 = m1 x1;2 + m2 ; C1 + C2 = a0 ; C1 x1 + C2 x2 = a1
1
1 + A 1 A 1 + A 1 +:::
= X
( 1)n A jt(0; 1;12; 1; 2n) = A 12 A 12
8
70
408
2378
n=1
1
= X
1
A
=
8
n=1 jt(1; 1; 2; 1; 2n)
1
X
p 2n 1
p
=
( 1)n A
(1
2) + (1 + 2)2n
n=1
1 +A 1 + A 1 + A 1 + :::
= A 13 + A 17
99
577
3363
f(n) := jt(0; 1; 2; 1; 2n) jt(0; 1; 2; 1;2n+ 1)2 + jt(1; 1; 2; 1; 2n + 1)
eg. f(0) = 2 52 + 7 = 57; f(1) = 12 292 + 41 = 10133; :::
1
1
X
= X
1
1
n
3 A jt(0; 1; 2; 1; 2n + 1)
3n A f(n)
8
n=1
n=1
1 + 3 A 1 + 3 A 1 + : : :
= A 15 + 3 A 29
1 1 169 1 5741 A 57 + 3 A 10133 + 3 A 1999509 + : : :
A P1 = 4 A Q 1 + A P 1 2 A q(Q1 ) (n odd)
n
n+2 n+4
n+2
= A 1 = 4 A1 + A 1 + A 1 + : : :
4
P1 1 5 1 169 5741
1
2 A q(5) + A q(169) + A q(5741) + : : :
45
(B.33)
(B.34)
(B.35)
(B.36)
(B.37)
(B.38)
(B.39)
(B.40)
(B.41)
(B.42)
(B.43)
(B.44)
with g(n) := jt(0; 1; 2; 1; n+ 3) jt(0; 1; 2; 1; n+ 2)2 + jt(1; 1; 2; 1; n + 2)
(B.45)
1
1
1
A jt(1; 1; 2; 1; n) = 5 A jt(1; 1; 2; 1; n+ 2) + 2 A jt(1; 1; 2; 1; n + 3)
(B.46)
1 (n odd)
A q(jt(0; 1; 2;1 1; n + 2)) + 2 A g(n)
= 2 A1 + A1 = 2 A1 + 2 A 1 + A 1 =
(B.47)
4
17
41
3 1 7 1 3
1 4A 1
= 12 A 17 + 5 A 41 2 A 70
(B.48)
307
1
1
1 4 A 1 12 A 1
1 (B.49)
= 70 A 99 + 29 A 239
2 A 70
24 A 58911
307
12238
1
1
= 408 A 577 + 169 A 1393
(B.50)
1 + 4 A 1 + 12 A 1 + 24 A 1 + 70 A 1 + 140 A 1 )
(2 A 70
307
12238
58911
:::
:::
APPENDIX B. MORE ARCTAN FORMULAS
46
1 = 2 (p2 1) X
1
jt(0;
1;
2;
1;
2n)
A
4
q(jt(0; 1; 2; 1;2n+ 1)) +
n=1
1
+ 2 jt(0; 1; 2; 1; 2n) A g(2n + 1)
1
1
X
1
= 3X
A
A jt(1; 1; 13; 1; 2n)
4
jt(1;
1;
3;
1;
2n)
n=1
n=11 1
1
1 + :::
= 3 A 4 + A 43 + A 469 + A 5116
1
1 + A 1 +A 1 +:::
A q(4) + A q(43)
q(469)
q(5116)
1 1
1
1
= 3 A 4 + A 43 + A 469 + A 5116 + : : :
1
1 +A 1 + :::
A 38 + A 39818
51581558
(B.52)
(B.53)
(B.54)
3
q(n) := 3n +2 n
Fn := jt(0; 1; 1; 1; n)
= Fibonacci(n) = 1; 1; 2; 3; 5;8;13;21;34;55;:::
1 A 1
A x1 = 2 A 2x
3x + 4x3
1
1
X
X
= 1
1
n
2 A 3 2n + 4 23n = 1
2n A q(2n1+1 )
4
= 1
n=0
n=0
(B.55)
(B.56)
(B.57)
(B.58)
1 + 8 A 1 + 16 A 1 + : : :
A 17 + 2 A 381 + 4 A 268
2072
16432
1
= X
AF 1
4
2n+1
n=1
1 +A 1 +A 1 + A 1 + :::
= A 21 + A 15 + A 13
34
89
233
1
1
1
1
AF = 3 AF
AF
A q(F ) )
2n
2n+2
2n+4
2n+2
p
1
X
= 3 5 5
F2n A q(F 1 )
4
2
2n+2
n=1
p
3
5
5
1
1
1
1
=
1 A 18 + 3 A 268 + 8 A 4662 + 21 A 83270 + : : :
2
A x + p1x2 4 =
1
X
A x jt(0; 1;1x; 1; n)2
n=1
for x = 2 :
A p1 2
= A 11
2+ 2 4
(B.51)
(B.59)
(B.60)
(B.61)
(B.62)
(B.63)
(B.64)
(B.65)
(B.66)
APPENDIX B. MORE ARCTAN FORMULAS
1
X
= 4 = A 2 1n2
n=1
for x = 4 :
A 4 + p142 4 = A 2 +1p3
1
=X
A 4 jt(0; 1; 14; 1; n)2
= 12
n=1
1
1 + A 1 + A 1 + A 1 + A 1 + :::
= A 4 + A 64
900
12544
174724
2433600
1
1
1
A 2x2 = 2 A 4x2 2x + 1 A 4x2 + 2x + 1 )
1 = X
1
1
A 2
+ A 4n2 + 2n + 1
4
n=1 4n 2n + 1
A 2x1 2 = 2 A 4x2 +12x + 1 A 2x31+ x + A 4x3 1+ 3x
A 2x1 2 = 2 A 4x2 12x + 1 + A 2x31+ x A 4x3 1+ 3x )
1 = X
1
1
1
A 2
+ A 2n3 + n A 4n3 + 3n
4
n=1 4n + 2n + 1
1
1
= X
A
2
6
n=0 2 jt(1; 3; 4; 1; n)
1 + A 1 + A 1 + A 1 + A 1 + :::
= A 12 + A 18
242
3362
46818
652082
1
= X
A 2n1 2 = (by changing the order of summation)
4
n=1
1
X
( 1)n (4n + 2)
=
(2n + 1)22n+1
n=0
47
(B.67)
(B.68)
(B.69)
(B.70)
(B.71)
(B.72)
(B.73)
(B.74)
(B.75)
(B.76)
(B.77)
(B.78)
(B.79)
Appendix C
Continued fractions
Set
x = b0 +
b1 +
a1
b2 +
a2
(C.1)
a3
b3 + b a+4 :::
4
For k > 0 let pq be the value of the above fraction if ak+1 is set to zero (set pq := 10 and pq := b1 ).
Then
pk = bk pk 1 + ak pk 2
(C.2)
qk = bk qk 1 + ak qk 2
(C.3)
(Simple continued fractions are those with ak = 1 8k).
Pseudo code for a procedure that computes the pk ; qk k = 1:::n of a continued fraction :
k
1
k
1
0
0
0
procedure ratios_from_contfrac(a[0..n], b[0..n], n, p[-1..n], q[-1..n])
{
p[-1] := 1
q[-1] := 0
p[0] := b[0]
q[0] := 1
for k:=1 to n
{
p[k] := b[k] * p[k-1] + a[k] * p[k-2]
q[k] := b[k] * q[k-1] + a[k] * q[k-2]
}
}
Pseudo code for a procedure that lls the rst n terms of the simple continued fraction of (the oating
point number) x into the array cf[]:
procedure continued_fraction(x, n, cf[0..n-1])
{
for k:=0 to n-1
48
APPENDIX C. CONTINUED FRACTIONS
49
{
xi := floor(x)
cf[k] := xi
x := 1/(x-xi)
}
}
Pseudo code for a function that computes the numerical value of a number x from (the leading n terms
of) its simple continued fraction representation:
function number_from_contfrac(cf[0..n-1], n)
{
x := cf[n-1]
for k:=n-2 to 0 step -1
{
x := 1/x+cf[k]
}
return x
}
(cf. [58], [59], [7], [8]).
Appendix D
A modulo multiplication trick
The following trick allows easy multiplication modulo some modulus that has more bits than a halfword.
It uses the fact that integer multiplication gets the least signicant bits of the result whereas oat
multiplication gets most signicant bits of the result.
The C-code given here assumes that you have 64 bit integer types sint64 (signed) and uint64 (unsigned)
and a oating point type with 64 bit mantissa, float64 (typically long double).
sint64 modulus;
float64 invmod=(float64)1.0/modulus;
sint64 mul(const sint64 a, const sint64 b)
{
sint64 quot;
sint64 rem;
quot = (sint64)((float64)a*(float64)b*invmodulus+(float64)0.5);
uint64 ab = (uint64)a*(uint64)b;
uint64 mq = (uint64)modulus*(uint64)quot;
rem = (sint64)(ab-mq);
if ( rem<0 ) // correction
{
rem += modulus;
quot--;
}
// quot == (a*b)/modulus
return rem; // (a*b)%modulus
}
The code works if 0 <= a, b < modulus < 263. Note that for xed modulus the division for the inverse
modulus invmod needs only be done once, so the routine avoids any division.
I found this trick in a documentation le (the le `PROJECTS' in version 2.02) of the gmp package ([55])
where it is ascribed to Peter Montgomery.
50
Bibliography
[1] C.Tripp: Inverse factorial series, The Mathematical Gazette (67) 1983 pp.183-188
[2] F.Chorlton: Pancake functions and approximations to , The Mathematical Gazette (79) 1995
pp.371-374
[3] B.C.Carlson: Algorithms involving arithmetic and geometric means, Amer. Math. Monthly (78)
1971 pp.496-505
[4] D.A.Cox: The arithmetic geometric means of Gauss, L'Enseign. Math. (2) 1984 pp.275-330
[5] D.E.Knuth: The Art of Computer Programming, 2.edition, Volume 2: Seminumerical Algorithms,
Addison-Wesley 1981,
online errata list at http://www-cs-staff.stanford.edu/~knuth/
[6] Jorg Sauerbrey: Langzahl-Modulo-Arithmetik fur kryptographische Verfahren, Deutscher Universitats Verlag 1993, ISBN 3-8244-2048-1, (in german)
[7] R.L.Graham, D.E.Knuth, O.Patashnik: Concrete Mathematics, Addison-Wesley, New York 1988
[8] I.N.Bronstein, K.A.Semendjajew, G.Grosche, V.Ziegler, D.Ziegler, ed: E.Zeidler: TeubnerTaschenbuch der Mathematik, vol. 1+2, B.G.Teubner Stuttgart, Leipzig 1996, the new edition
of Bronstein's Handbook of Mathematics, (english edition in preparation)
[9] J.Stoer, R.Bulirsch: Introduction to Numerical Analysis, Springer-Verlag, New York, Heidelberg,
Berlin 1980
[10] W.H.Press, S.A.Teukolsky, W.T.Vetterling, B.P.Flannery: Numerical Recipes in C, Cambridge
University Press, 1988, 2nd Edition 1992
online at http://nr.harvard.edu/nr/be careful with the code !
[11] H.Cohen: A Course in Computational Algebraic Number Theory, Springer Verlag, Berlin Heidelberg
1993,
errata list online at ftp://megrez.math.u-bordeaux.fr/pub/cohenbook/
[12] S.Rabinowitz, S.Wagon: A Spigot Algorithm for the Digits of , Amer. Math. Monthly, (102) March
1995 pp.195-203
[13] S.Wedeniwski: Piologie - Implementierung ezienter arithmetischer Algorithmen in ANSI-C++,
1996 (in german)
online at ftp://ftp.informatik.uni-tuebingen.de/pub/CA/software/piologie-1.0.tar.gz
[14] E.Schroder: On Innitely Many Algorithms for Solving Equations (translation by G.W.Stewart of:
`Ueber unendlich viele Algorithmen zur Auosung der Gleichungen', which appeared 1870 in the
`Mathematische Annalen')
online at ftp://thales.cs.umd.edu/pub/reports/
[15] J.M.Borwein, P.B.Borwein: Pi and the AGM, Wiley 1987
51
BIBLIOGRAPHY
52
[16] J.M.Borwein, P.B.Borwein: On the complexity of familiar functions and numbers, SIAM Rev.
Vol.30 December 1988, pp.589-601
[17] J.M.Borwein, P.B.Borwein: More Ramanujan-type Series for 1=, in: `Ramanujan Revisited', Proceedings of the Centenary Conference, Univ. of Illinois at Urbana-Champaign June 1-5, 1987 pp.359374
[18] J.M.Borwein, P.B.Borwein: Scientic American, March 1988
[19] J.M.Borwein, P.B.Borwein: More quadratically Converging Algorithms for Pi, Mathematics of
Computation, (46), January 1986, pp.247-253
[20] J.M.Borwein, P.B.Borwein: The Arithmetic-Geometric Mean and Fast Computation of Elementary
Functions, SIAM Rev. (26) 1984, pp.351-365
[21] J.M.Borwein, P.B.Borwein: Cubic and higher order algorithms for , Cand. Math. Bull. Vol 27 (4)
1984,
online at http://www.cecm.sfu.ca/~pborwein/
[22] J.M.Borwein, P.B.Borwein, F.Garvan: Some cubic modular identities of Ramanujan, Trans. A.M.S.
343, 1994, pp.35-47
[23] J.M.Borwein, P.B.Borwein: Some modular identities of Ramanujan useful in approximating ,
Proceedings of the American Mathematical Society, (95), November 1985, pp.365-371
[24] J.M.Borwein, B.B.Borwein: A Very Rapidly Convergent Product Expansion for , BIT (23) 1983
pp.538-540
[25] D.H.Bailey, J.M.Borwein, P.B.Borwein and S.Ploue: The Quest for Pi, 1996,
online at http://www.cecm.sfu.ca/~pborwein/
[26] B.C.Berndt: An overview of Ramanujan's notebooks, Proc. Conf. Karl der Grosse (to appear)
online at http://www.math.uiuc.edu/ berndt/
[27] B.C.Berndt: Ramanujan's Modular Equations, pp.313-333 in `Ramanujan Revisited', Proceedings
of the Centenary Conference, Univ. of Illinois at Urbana-Champaign June 1-5, 1987
[28] S.Ramanujan: Modular Equations and Approximations to , Quart. J. Math. (45) 1914, pp.350-372
in: G.H.Hardy, P.V.Seshu Aiyar, B.M.Wilson: Collected Papers of Srinivasa Ramanujan, Chelsea
Publ. 1927, reprinted 1962
[29] C.Strmer: Sur l'application de la theorie des nombres entiers complexes a la solution en nombres
rationels x1x2 :::xnc1c2 :::cn; k de l'equation: c1 arctg x1 +c2 arctg x2 +::::+cnarctg xn = k 4 , Archiv
for Math. og Naturv., (19) 1896, no.3, pp.1-96
[30] J.Todd: A Problem on Arctangent Relations, MAA Monthly, (8) 1949, pp.517-528
[31] D.H.Lehmer: On Arccotangent Relations for , MAA Monthly (45) 1938, pp.657-664
[32] D.H.Lehmer: A cotangent analogue of continued fractions, Duke Math, Journal (4) 1938, p.323-340
[33] D.Shanks, J.W.Wrench: Calculation of to 100,000 Decimals, Math. Comp., 1961
[34] D.H.Bailey: The Computation fo To 29,360,000 Decimal Digits Using Borweins' Quartically
Convergent Algorithm,
online at http://www.nas.nasa.gov//~dbailey/dbailey.html
[35] H.R.P.Ferguson, D.H.Bailey: A Polynomial Time, Numerically Stable Integer Relation Algorithm,
RNR Technical Report RNR-91-023, 1992
online at http://www.nas.nasa.gov//~dbailey/dbailey.html
BIBLIOGRAPHY
53
[36] D.H.Bailey: Numerical Results on the Transcendence of Constants Involving , e, and Euler's
Constant
[37] D.H.Bailey, S.Ploue: Recognizing Numerical Constants
online at http://www.cecm.sfu.ca/organics/papers/
[38] D.H.Bailey, J.M.Borwein, P.B.Borwein: Ramanujan, Modular Equations, and Approximations to
Pi or How to compute One Billion Digits of Pi, Amer. Math. Monthly, (96) 1989, pp.201-219,
(an extended version is) online at http://www.cecm.sfu.ca/organics/papers/
[39] D.H.Bailey: A Portable High Performance Multiple Precision Package, RNR Technical Report
RNR-90-022, May 18, 1993
online at http://www.nas.nasa.gov//~dbailey/dbailey.html
[40] Newman: A Simplied Version of Fast Algorithms of Brent and Salamin, Math. Comp. (44), 1985,
pp.207-210
[41] Mikko Tommila: apoat, A High Performance Arbitrary Precision Arithmetic Package, 1996,
online at http://www.hut.fi/~mtommila/apfloat/
[42] D.Bailey, P.Borwein, S.Ploue: On the rapid computation of various polylogarithmic constants,
online at http://www.cecm.sfu.ca/~pborwein/
[43] E.Salamin: Computation of Using the Arithmetic-Geometric Mean, Mathematics of Computation
(30), july 1976, pp.565-570
[44] M.Waldschmidt, P.Moussa, J.-M. Luck, C.Itzykson (Eds.): From Number Theory to Physics,
Springer Verlag 1992
[45] E.Weisstein: (online document about mathematics),
online at http://www.gps.caltech.edu/~eww/math/
[46] J.Arndt: remarks on FFT algorithms (online document), 1996
online at http://www.jjj.de/fxt/
[47] H.-D.Ebbinghaus, H.Hermes, F.Hirzebruch, M.Koecher, K.Mainzer, J.Neukirch, A.Prestel,
R.Remmert: Zahlen (title of english translation: Numbers), 2.ed, Springer, 1988
[48] S.Ramanujan: Squaring the Circle, Journal of the Indian Mathematical Society, V, p.132, 1913
in: G.H.Hardy, P.V.Seshu Aiyar, B.M.Wilson: Collected Papers of Srinivasa Ramanujan, Chelsea
Publ. 1927, reprinted 1962
[49] J.M.Borwein, F.G.Garvan: Approximations to via the Dedekind eta function, (1996)
online at http://www.cecm.sfu.ca/~jborwein/
[50] D.V.Chudnovsky, G.V.Chudnovsky: Approximations and complex multiplication according to Ramanujan, pp. 375-472 in `Ramanujan Revisited', Proceedings of the Centenary Conference, Univ.
of Illinois at Urbana-Champaign June 1-5, 1987
[51] J.M.Borwein, R.Girgenson: Addition theorems and binary expansions, Canadian J. Math. (47)
1995, pp.262-273,
online at http://www.cecm.sfu.ca/~jborwein/
[52] E.Stoschek: Algorithmenkonstruktion, Reektionen aus der Sicht eines Informatikers und Elektrotechnikers, TU Dresden, Fakultat Informatik, Institut fur Theoretische Informatik, 1995,
online at http://www.inf.tu-dresden.de/TU/Informatik/ThI/scripte/
[53] K.Knopp: Theorie und Anwendung der unendlichen Reihen, Springer-Verlag 1882
BIBLIOGRAPHY
54
[54] B.Haible, T.Papanikolaou: Fast multiprecision evaluation of series of rational numbers, technical
report
online at http://www./
[55] T.Granlund: GNU MP, The GNU Multiple Precision Arithmetic Library, Edition 2.02, June 1996
online at: ftp://prep.ai.mit.edu/pub/gnu/
[56] B.Haible CLN, a class library for numbers
online at: ftp://ma2s2.mathematik.uni-karlsruhe.de/pub/gnu/cln.tar.gz
[57] M.Beeler, R.W.Gosper, R.Schroeppel: HAKMEM. MIT AI Memo 239, Feb. 29, 1972, Retyped and
converted to html by Henry Baker, April 1995,
online at: ftp://ftp.netcom.com/pub/hb/hbaker/hakmem/hakmem.html/#contents
[58] C.D.Olds: Continued Fractions, The Mathematical Association of America, 1963
[59] L.Lorentzen and H.Waadeland: Continued Fractions and Applications, North-Holland 1992 pp.561562
[60] H-O.Peitgen, H.Jurgens, D.Saupe: Chaos and Fractals, Springer 1992
[61] A.Schonhage, V.Strassen: Schnelle Multiplikation grosser Zahlen, Computing (7) 1971 pp.281-292
(in german)
[62] R.P.Brent: Fast multiple-precision evaluation of elementary functions, J. ACM (23) 1976 pp.242-251
[63] Householder: The Numerical Treatment of a Single Nonlinear Equation, McGraw-Hill 1970
[64] D.V.Chudnovsky, G.V.Chudnovsky: Classical constants and functions: computations and continued fraction expansions, in Number Theory: New York seminar 1989-1990, Springer Verlag 1991
[65] D.V.Chudnovsky, G.V.Chudnovsky: The Computation of classical constants, Proc. Natl. Acad. Sci.
USA (86) 1989 pp.8178-8182
[66] G.M.Phillips: Archimedes and the complex plane, Amer. Math. Monthly. (91) 1984 pp.108-114
[67] Hardy: Elliptic and Modular Functions, in: Ramanujan, Twelve Lectures on Subjects Suggested
by his Life and Work, Chelsea Publ. Co 1940
[68] F.L.Bauer: A Series from the Karanapaddhati, The Mathematical Intelligencer, (17) 1995 pp.3-4
[69] D.Gale: The Truth and Nothing But the Truth, The Mathematical Intelligencer, (11) 1989 pp.62-67
[70] M.Keith: Circle Digits. A Self Referential Story, The Mathematical Intelligencer, (8) 1986 pp.56-57
[71] P.Soderquist, M.Leeser: An Area/Performance Comparison of Subtractive and Multiplicative Divide/Square Root Implementations, Cornell School of Electrical Engineering
online at http://orac.ee.cornell.edu:80/unit1/pgs/#papers
[72] F.Bellard: A new formula to compute the n'th binary digit of pi, January 20, 1997
online at http://www-stud.enst.fr/ bellard/
[73] H.C.Thacher: Iterated square root expansions for the inverse cosine and inverse hyperbolic cosine,
Math. Comp. (15) 1961 pp.399-403
[74] I.Ninomiya: Best rational starting approximations and improved Newton iteration for square roots,
Math. Comp. (24) 1970 pp.391-404
[75] R.E.Crandall, B.Fagin: Discrete Weighted Transforms and Large Integer Arithmetic, Math. Comp.
(62) 1994 pp.305-324
BIBLIOGRAPHY
55
[76] P.L.Montgomery: Modular Multiplication Without Trial Division, Math. Comp. (44) April 1985
pp.519-521
[77] T.Granlund, P.L.Montgomery: Division by Invariant Integers using Multiplication, in Proceedings
of the SIGPLAN PLDI'94 Conference, June 1994
[78] J.Todd: The many limits of mixed means, I, II, ISNM (41) 1978, pp.5-22
[79] M.Wethereld: The enhancement of Machin's formula by Todd's process, The Math. Gaz. 1997,
pp.333-344
[80] G.Lochs: Vergleich der Genauigkeit von Dezimalbruch und Kettenbruch, Abh. Math. Seminar
Hamburg, (27) 1964 pp.142-144
Download