Approximating pi

Griffin, who attends the Programmers Anonymous meetings wrote a nice program to evaluate a series approximation of pi. He used the first n terms of the Wallis product:

Pi/2 = 2 * 2 * 3 * 3 * 4 * 4 ...
1 3 3 4 4 5 ...

As the terms get very large, rounding errors due to dividing large integers causes the approximation to drift away from the true limiting value of the product. The rounding errors result from limited precision of the standard computer representation of real numbers.

Wallis product program output, link to

The series converges very slowly, only to five dcimal places after about 50,000 terms, about where rounding errors limit precision.

I hadn't heard of the Wallis product, but I know of several other infinite series that are related to pi. Here's a short list from Classical Approximations of Pi:

classical approximation of pi

Most interesting is Euler's series, named after Leonhard Euler for solving the Basel problem in 1735. Euler developed many related techniques and relationships of what is now called mathematical analysis (from Greek ἀνάλυσις, "a breaking up"), the process of breaking a complex topic or substance into smaller parts to gain a better understanding of it.

Curiously, the Euler's series is closely related to prime numbers, through the Reimann zeta function ( the series is Zeta(2) ).

The series is also nice for its simplicity, its relationship to other series, and because it converges quickly.

There are many other numerical methods of finding approximations of pi, other than these infinite series. Many are listed here, including one that involves an infinite product of primes!

"A few notes on Pi" introduces other methods of approximating pi, noteably methods that use randomness.

 

Comments

Post new comment

Security question, designed to stop automated spam bots