## How to calculate π

How would you calculate $\pi$? I remember being sent as a boy of ten into the schoolyard to find circular objects to measure. Our attempts to wrap a tape around a dustbin lid clearly did not represent the optimal method.

Perhaps you know a few digits of $\pi$. Starting from scratch, how would you find more? We know $\pi$ is irrational, so it cannot be expressed as the ratio of two numbers. Worse, $\pi$ is transcendental, so it is not the solution of any polynomial equation with integer coefficients.

There is a passage of the Bible (1 Kings 7:23) which refers to “a molten sea” which is “ten cubits from the one brim to the other” and “a line of thirty cubits did compass it about”. This figure of $\pi=3$ did not represent the state of the art, with more accurate values being recorded much earlier in Egypt and Mesopotamia.

A famous approximation is attributed to Archimedes (287-212 BC), who worked using only geometric methods. Archimedes took a circle and inscribed within it a polygon. The perimeter of the polygon, which is contained within the circle, is smaller than the circumference of the circle itself. Then he superscribed a polygon outside the circle. The perimeter of this second, larger polygon is larger than the circumference of the circle itself. If you think about increasing the number of sides on a polygon you will notice that the more sides a polygon has, the closer it gets to the shape of a circle. By increasing the number of sides on his two polygons and considering their perimeters, Archimedes could define two series, one increasing and one decreasing, both of which have $\pi$ in their limit.

Archimedes took this as far as polygons of 96 sides and came up with an upper limit for $\pi$ of $\frac{22}{7} \approx 3.142857$ and a lower limit of $\frac{223}{71} \approx 3.140845$. Because these coincide in the first three digits, we can conclude that $\pi$ begins $3.14 \ldots$

Others, following the method of Archimedes or developing it independently, extended to polygons with greater numbers of sides. This method culminated with Ludolph Van Ceulen who, around 1600, produced an approximation for $\pi$ to 35 decimal places. Those 35 digits were inscribed on Van Ceulen’s tombstone.

More modern approximations involve calculating the terms of an infinite series involving $\pi$, which can be rearranged to find an approximation for $\pi$. For example, the following was discovered by James Gregory:

$\frac{pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\ldots$

Using such a formula, one can generate $\pi$ to as many decimal places as necessary by taking more terms. However, this series converges very slowly. For example, 10,000 terms are needed to get just four decimal places. John Machin found a series that converges much more quickly to $\frac{pi}{4}$:

$\frac{\pi}{4}=4 \arctan{\frac{1}{5}}-\arctan{\frac{1}{239}}$

which uses a more general James Gregory result:

$\arctan{x}=x-\frac{x^3}{3}+\frac{x^5}{5}- \ldots (-1\leq x \leq 1)$

Machin used this formula to calculate one hundred digits of $\pi$ in 1706, the year William Jones introduced the modern use of the Greek letter π.

Computers enter the story in 1947 when D. F. Ferguson of the Royal Naval College in England calculated $\pi$ to 710 digits with a desk calculator. In 1950 George W. Reitwiesner published more than 2000 digits of $\pi$ in the journal Mathematics of Computation. These digits were calculated on the ENIAC computer at the suggestion of John von Neumann, who was interested to obtain a statistical measure of the randomness of the distribution of the digits (whether digits occur equally often in $\pi$ remains an open question).  Reitwiesner and his team used the same formula as Machin and ran ENIAC for around 70 hours, including the time taken to handle the punch cards.

More recently, series are used which operate on similar principles but converge even more quickly. The latest computer record used the 1989 Chudnovsky algorithm, which is based on the series:

$\frac{1}{\pi} = 12 \sum^\infty_{k=0} \frac{(-1)^k (6k)! (13591409 + 545140134k)}{(3k)!(k!)^3 640320^{3k + 3/2}}.!$

In 2011 Shigeru Kondo set this record on a custom-built home computer using y-cruncher, a program written by Alexander Yee, to calculate $\pi$ to ten trillion digits.