### Happy Pi Day!

#### 2019-03-14 21:39:10

In honor of Pi Day (March 14), here's a simple method for computing \(\pi\), or more accurately, \(2\pi\). This is equivalent to the method used by Archimedes in the third century BCE to approximate \(\pi\). He inscribed a regular hexagon inside a circle, and a hexagon circumscribing the circle. He found their respective perimeters, which form a lower bound and an upper bound for \(2\pi\) (the circumference of the circle itself). Then Archimedes repeatedly doubled the sides of the regular polygons, and arrived at the familiar approximation \(\pi\approx 22/7\).

In modern terms, his method can be described as a recursion. If \(p_n\) is the perimeter of an inscribed regular polygon with \(n\) sides, and \(P_n\) the perimeter of the circumscribed polygon with \(n\) sides, we can show \(p_6 = 6\) and \(P_6=4\sqrt{3}\). The recursion is
\[
\begin{align*}
P_{2n} &= \frac{2p_nP_n}{p_n+P_n} \\
p_{2n} &= \sqrt{p_nP_{2n}}.
\end{align*}\]
These can be proved using some trig; it turns out
\[\begin{align*}p_n&=2n\sin\theta\\
P_n&=2n\tan\theta
\end{align*}\]
But the recursion does converge, although somewhat slowly. It takes about sixteen iterations to obtain nine places of accuracy: \(2\pi = 6.283185307\). (Archimedes in effect did three iterations.)