Pi Iterations

DOWNLOAD Mathematica Notebook Contribute to this entry

pi may be computed using a number of iterative algorithms. The best known such algorithms are the Archimedes algorithm, which was derived by Pfaff in 1800, and the Brent-Salamin formula. Borwein et al. (1989) discuss pth-order iterative algorithms.

The Brent-Salamin formula is a quadratically converging algorithm.

Another quadratically converging algorithm (Borwein and Borwein 1987, pp. 46-48) is obtained by defining

x_0=sqrt(2)
(1)
y_1=2^(1/4)
(2)

and

x_n=1/2(x_(n-1)^(1/2)+x_(n-1)^(-1/2))
(3)
y_n=(y_(n-1)x_(n-1)^(1/2)+x_(n-1)^(-1/2))/(y_(n-1)+1).
(4)

Then

 pi_n=pi_(n-1)(x_n+1)/(y_n+1),
(5)

with pi_0=2+sqrt(2). pi_n decreases monotonically to pi with

 pi_n-pi<10^(-2^(n+1))
(6)

for n>=2.

A cubically converging algorithm which converges to the nearest multiple of pi to f_0 is the simple iteration

 f_n=f_(n-1)+sin(f_(n-1))
(7)

(Beeler et al. 1972). For example, applying to 23 gives the sequence 23, 22.1537796, 21.99186453, 21.99114858, ..., which converges to 7pi approx 21.99114858.

A quartically converging algorithm is obtained by letting

y_0=sqrt(lambda^*(r))
(8)
alpha_0=alpha(r),
(9)

then defining

y_n=(1-(1-y_(n-1)^4)^(1/4))/(1+(1-y_(n-1)^4)^(1/4))
(10)
alpha_n=(1+y_n)^4alpha_(n-1)-4^nsqrt(r)y_n(1+y_n+y_n^2).
(11)

Then

 pi=lim_(n->infty)1/(alpha_n)
(12)

and alpha_n converges to 1/pi quartically with

 alpha_n-1/pi<16·4^nsqrt(r)e^(-4^npisqrt(r))
(13)

(Borwein and Borwein 1987, pp. 170-171; Bailey 1988, Borwein et al. 1989). This algorithm rests on a modular equation identity of order 4. Taking the special case r=2 gives y_0=sqrt(2)-1 and alpha_0=2(sqrt(2)-1)^2=6-4sqrt(2).

A quintically converging algorithm is obtained by letting

s_0=5(sqrt(5)-2)
(14)
alpha_0=1/2.
(15)

Then let

 s_n=(25)/((z+x/z+1)^2s_(n-1)),
(16)

where

x=5/(s_n)-1
(17)
y=(x-1)^2+7
(18)
z=[1/2x(y+sqrt(y^2-4x^3))]^(1/5).
(19)

Finally, let

 alpha_(n+1)=s_n^2alpha_n-5^n[1/2(s_n^2-5)+sqrt(s_n(s_n^2-2s_n+5))],
(20)

then

 0<alpha_n-1/pi<16·5^ne^(-pi5^n)
(21)

(Borwein et al. 1989). This algorithm rests on a modular equation identity of order 5.

Beginning with any positive integer n, round up to the nearest multiple of n-1, then up to the nearest multiple of n-2, and so on, up to the nearest multiple of 1. Let f(n) denote the result. Then the ratio

 lim_(n->infty)(n^2)/(f(n))=pi.
(22)

David (1957) credits this result to Jabotinski and Erdős and gives the more precise asymptotic result

 f(n)=(n^2)/pi+O(n^(4/3)).
(23)

The first few numbers in the sequence {f(n)} are 1, 2, 4, 6, 10, 12, 18, 22, 30, 34, ... (OEIS A002491).

Another algorithm is due to Woon (1995). Define a(0)=1 and

 a(n)=sqrt(1+[sum_(k=0)^(n-1)a(k)]^2).
(24)

It can be proved by induction that

 a(n)=csc(pi/(2^(n+1))).
(25)

For n=0, the identity holds. If it holds for n<=t, then

 a(t+1)=sqrt(1+[sum_(k=0)^tcsc(pi/(2^(k+1)))]^2),
(26)

but

 csc(pi/(2^(k+1)))=cot(pi/(2^(k+2)))-cot(pi/(2^(k+1))),
(27)

so

 sum_(k=0)^tcsc(pi/(2^(k+1)))=cot(pi/(2^(t+2))).
(28)

Therefore,

 a(t+1)=csc(pi/(2^(t+2))),
(29)

so the identity holds for n=t+1 and, by induction, for all nonnegative n, and

lim_(n->infty)(2^(n+1))/(a(n))=lim_(n->infty)2^(n+1)sin(pi/(2^(n+1)))
(30)
=lim_(n->infty)2^(n+1)pi/(2^(n+1))(sin(pi/(2^(n+1))))/(pi/(2^(n+1)))
(31)
=pilim_(theta->0)(sintheta)/theta=pi.
(32)

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.