Why Compute Pi?



I became interested in mathematics at an early age because I had an aptitude for it. In the 6th grade I enjoyed long division because it came easy for me. Then in high school, taking square roots long hand was a kick. I liked mathematics and I liked to compute.

They first told me that pi was 22/7, and we solved problem like the circumference of a circle with a diameter of 7 inches being 22 inches. Later I found out that 22/7 was only an approximate value for pi. Pi was the first number like this for me. When I got a numerical answer containing, for example, the square root of 2 I knew how to compute the answer because I knew how to compute the square root of 2. When an answer contained pi, it was a little less known.

Later when we got into logarithms, exponentials, and trigonometric functions, many numerical answers were only approximations, but pi was the first for me.

The first time I tried to compute pi to more places than is normally needed, I computed it to 50 decimal places using paper, pencil, and a hand calculator. The equation used was

π = 16 * ArcTan(1/5) − 4 * ArcTan(1/239)

ArcTan(1/x) = 1/x − 1/(3 * x**3) + 1/(5 * x**5) − ...

This was done in the early 1970's. The equation was derived in 1706 by John Machin (1685-1751). After I got my Apple II+ computer in 1979, I computed pi to 15,300 decimal places using Apple Pascal and the equation

π = 48 * ArcTan(1/18) + 32 * ArcTan(1/57) − 20 * ArcTan(1/239)

This is the same equation I used in 1989 to compute a 114,632 decimal place value using Borland Turbo Pascal on an IBM AT compatible computer. The equation is due to Carl Friedrich Gauss (1777-1855).

I now have developed a package on a PC that computes pi in the 1,000,000 decimal digit range and runs in a time of approximately O(n Log(3n)).

The algorithms used are documented in Scientific American, February 1988, Ramanujan and Pi, by Jonathan M. Borwein and Peter B. Borwein.

Algorithm a:

Let y[0] = SqRt(1/2), x[0] = 1/2

y[n] = (1 − SqRt(1 − y[n−1]^2)) / (1 + SqRt(1 − y[n−1]^2))

x[n] = ((1 + y[n])^2 * x[n−1]) − 2^n * y[n]

Algorithm b:

Let y[0] = SqRt(2) − 1, x[0] = 6 − 4 * SqRt(2)

y[n] = (1 − SqRt(SqRt(1 − y[n−1]^4))) / (1 + SqRt(SqRt(1 − y[n−1]^4)))

x[n] = ((1 + y[n])^4 * x[n−1]) − 2^(2n+1) * y[n] * (1 + y[n] + y[n]^2)

For both algorithms, x[n] converges to 1/π. Algorithm a is quadratically convergent and algorithm b is quartically convergent.

-Harry

Return to Computing Pi
Return to Harry's Home Page


This page accessed times since October 20, 2004.
Page created by: hjsmithh@sbcglobal.net
Changes last made on Sunday, 17-Jul-05 13:00:58 PDT