# Faster Pi

There is a more astonishing algorithm than what is described in “Fast Pi” for rapidly calculating $\pi.$

Let us consider the three-term iteration with initial values $a_0 = \sqrt{2}, \quad b_0 =0, \quad \pi_0 = 2+\sqrt{2}$

given by $a_n = \frac{1}{2}\left(\sqrt{a_{n-1}} + \frac{1}{\sqrt{a_{n-1}}}\right), \quad b_{n} = \sqrt{a_{n-1}}\left(\frac{b_{n-1}+1}{b_{n-1} + a_{n-1}}\right), \quad \pi_{n} = \pi_{n-1}b_n\left(\frac{1+a_{n}}{1+b_{n}}\right).$

Then $\pi_n$ converges exponentially to $\pi$. In fact, $|\pi-\pi_n|< \frac{1}{10^{2^n}}.$

Implemented in Omega CAS Explorer, $4$ iterations yield $40$ digits of $\pi$:

The $8$th iteration gives $\pi$ correctly to $694$ digits:

Exercise-1 Show that $20$ iterations will provide over $2$ million digits of $\pi.$

# Fast Pi

There is a recipe for rapidly calculating the digits of $\pi$.

Consider the two-term iteration with initial values $a_0 = \sqrt{2}, \quad b_0 = 1\quad\quad\quad(1)$

given by $a_n = \frac{a_{n-1}+b_{n-1}}{2}, \quad b_n = \sqrt{a_{n-1} b_{n-1}}, \quad n \ge 1.\quad\quad\quad(2)$

Then $\pi_{n} = \frac{a_n^2}{1-\sum\limits_{i=0}^{n}2^{i-1}\left(a_n^2-b_n^2\right)}\quad\quad\quad(3)$

converges to $\pi.$

We have implemented (1), (2) and (3) in Omega CAS Explorer (see Fig. 1). With merely 4 iterations, it gives astounding 20 decimal places of $\pi$!

Fig. 1

# Sandwich Theorems and Their Proofs

Prove: $\begin{cases} \exists N\in \mathbb{N} \ni n > N, a_n \le b_n \le c_n\quad\quad(1)\\ \lim\limits_{n \rightarrow \infty}a_n=\lim\limits_{n\rightarrow \infty}c_n=L \quad\quad\quad\quad\quad\quad(2) \end{cases}\implies \lim\limits_{n\rightarrow \infty}b_n = L.$

We express (1) as $n > N \implies a_n \le b_n \le c_n$

and (2): $\forall \epsilon >0, \exists n_1 \ni n >n_1 \implies |a_n-L|< \epsilon.$ $\forall \epsilon >0, \exists n_2 \ni n >n_2 \implies |c_n-L|< \epsilon.$

Let $n^* = \mathrm{\bold{max}}(N, n_1, n_2).$

We have $n>n^* \implies a_n \le b_n \le c_n.$ $\forall \epsilon >0, n>n^* \implies |a_n-L|<\epsilon.$ $\forall \epsilon >0, n>n^* \implies |a_n-L|<\epsilon.$

It means $n>n^* \implies \underline{a_n \le b_n \le c_n}.$ $\forall \epsilon > 0, n >n^* \implies \underline{-\epsilon +L < a_n} < \epsilon + L.$ $\forall \epsilon > 0, n >n^* \implies -\epsilon +L < \underline{c_n < \epsilon + L}.$

Hence, $\forall \epsilon >0, n>n^* \implies -\epsilon + L < \underline{a_n \le b_n \le c_n} < \epsilon+L.$

That is, $\forall \epsilon >0, \exists n^* \ni n > n^* \implies -\epsilon + L < b_n < \epsilon + L.$

i.e., $\forall \epsilon >0, \exists n^* \ni n > n^* \implies |b_n-L| < \epsilon.$

It follows that $\lim\limits_{n \rightarrow \infty} b_n = L.$

Exercise 1 Prove: $\begin{cases} \exists \delta \ni |x-a| < \delta, f(x) \le g(x) \le h(x) \quad\quad\quad(1) \\ \lim\limits_{x \rightarrow a }f(x)=\lim\limits_{x\rightarrow a}h(x)=L \quad\quad\quad\quad\quad\quad\quad\quad(2) \end{cases}\implies \lim\limits_{x\rightarrow a}g(x) = L.$