Finding a recursive formula/sum for $\pi$

4k Views Asked by At

I'm very much aware of the
$$\pi = 4 \left(1 - \frac13 + \frac15 - \frac17 + \frac19 -\cdots \right)$$ and
$$\pi = \sqrt{6\left(1 + \frac14 + \frac19 + \frac{1}{16}+ \cdots \right)}$$ and even less common $$\frac\pi2 = \frac21 \cdot \frac23 \cdot \frac43 \cdot \frac45 \cdot \frac65 \cdot \frac67 \cdot \frac87 \cdot \cdots$$

What I'm wondering is if there is a RECURSIVE (not summative) way to find $\pi$.

An example for phi ($\phi$) is: $$f(1) = 1; \quad f(n) = 1+\frac1{f(n-1)}$$

By recursive function, I mean a function that calculates its next value based on the current or previous (or even further back) value.

7

There are 7 best solutions below

0
On

Your question is not very clear, in case of $\phi$ we calculate $\phi(n)$ but we do not calculate $\pi(n)$. $\pi$ is a constant, and you want recursive formula, so from the context i assume you want to calculate the value of $\pi$ using a recursion. To calculate value of $\pi$ using recursion you can use any of the formula listed above.
e.g.
$\pi = \displaystyle \prod_{n=1}^{\infty} \cfrac{2n}{2n -1} \cfrac{2n}{2n - 1} $
You can do like this
$\pi =\lim_{z \to \infty} \displaystyle \prod_{n=1}^{z} \cfrac{2n}{2n -1} \cfrac{2n}{2n - 1} $
$\pi(z) = \displaystyle \prod_{n=1}^{z} \cfrac{2n}{2n -1} \cfrac{2n}{2n - 1} \implies \pi(z) = \pi(z-1) \cfrac{2z}{2z -1} \cfrac{2z}{2z - 1}$
More the value of z more accurate value of $\pi$ you will get.

0
On

I'll point out that any summative formula can be turned into a recursive one: $$f(1) = 1, \quad f(n) = f(n-1) + \frac{1}{n^2}$$ has $\lim_{n \to \infty} f(n) = \frac{\pi^2}{6}$.

0
On

Perhaps you'd be interested in something like Borwein's algorithm or the Brent-Salamin algorithm. See this Wikipedia article for Borwein's algorithm or here for Brent–Salamin. There are several StackExchange posts related to calculating $\pi$ as well, e.g this one.

3
On

There is no rational recurrence of the form

$$\pi_{n+1}=\frac{P(\pi_n)}{Q(\pi_n)}$$ where $P,Q$ are polynomials with algebraic coefficients, because that would mean that $\pi$ is itself algebraic (it would be solution of $x Q(x)-P(x)=0$).

If transcendental functions are allowed, you can use the interesting

$$\pi_{n+1}=\pi_n+\sin\pi_n$$

but it is simpler to directly use $\pi_n=4\arctan 1$.

(This essentially means that there is no suitable recurrence.)

2
On

You may compute the coefficients of a generalized Shafer-Fink inequality with high order and evaluate it at $1$ (or at $\frac{1}{\sqrt{3}}$, or at $\sqrt{2}-1$). The first approximations produced by this approach are

$$ \pi\approx \frac{12}{1+2\sqrt{2}},\qquad \pi\approx\frac{180}{7+6\sqrt{2}+16\sqrt{4+2\sqrt{2}}} $$ $$ \pi\approx \frac{18}{13}(4-\sqrt{3}),\quad \pi\approx\frac{270 \sqrt{3}}{21+12 \sqrt{3}+32 \sqrt{3 \left(2+\sqrt{3}\right)}}$$ $$\pi\approx \frac{24 \left(\sqrt{2}-1\right)}{1+2 \sqrt{4-2 \sqrt{2}}},\quad \pi\approx \color{green}{\frac{360 \left(\sqrt{2}-1\right)}{7+6 \sqrt{4-2 \sqrt{2}}+16 \sqrt{2 \left(4-2 \sqrt{2}+\sqrt{4-2 \sqrt{2}}\right)}}}$$ and an hybridation with other classical approaches (continued fractions, Taylor expansions at peculiar points and Machin-like formulas) is also possible and pretty simple.

0
On

If you allow more complicated sequences (so called "iterated means"), there are several that give $\pi$ in various forms and do not explicitly contain $n$ in their definition.

For example:

$$a_{n+1}=\frac{\sqrt{(a_n+b_n)(a_n+c_n)}}{2} \\ b_{n+1}=\frac{\sqrt{(b_n+a_n)(b_n+c_n)}}{2} \\ c_{n+1}=\frac{\sqrt{(c_n+a_n)(c_n+b_n)}}{2}$$

$$L(a_0,b_0,c_0)=\lim_{n \to \infty}a_n=\lim_{n \to \infty}b_n=\lim_{n \to \infty}c_n$$

We have:

$$L(1,1,1/2)=\frac{3 \sqrt{3}}{2 \pi }$$

$$L(1,1,1/\sqrt{2})=\frac{2 \sqrt{2}}{\pi}$$


Or another one:

$$a_{n+1}=\sqrt{a_n \frac{b_n+c_n}{2}},\quad b_{n+1}=\sqrt{b_n \frac{c_n+a_n}{2}},\quad c_{n+1}=\sqrt{c_n \frac{a_n+b_n}{2}}$$

$$M(a_0,b_0,c_0)=\lim_{n \to \infty} a_n=\lim_{n \to \infty} b_n=\lim_{n \to \infty} c_n$$

$$M(1,1,2)=\frac{3^{3/4}}{\sqrt{\pi}}$$

$$M(1,1,\sqrt{2})=\frac{2}{\sqrt{\pi}}$$


There's a more simple (and famous) Arithmetic-Geometric mean, but as far as I know, it doesn't give $\pi$ on its own, but rather more complicated constant, involving Gamma function (Gauss' constant).

0
On

Here is a recursive approach to calculate $\pi$. Since

$$\tan^{-1}x=2\sum\limits_{n=1}^{\infty }{\frac{1}{2n-1}\frac{{{a}_{n}}\left( x \right)}{a_{n}^{2}\left( x \right)+b_{n}^{2}\left( x \right)}}, $$ where $$\begin{align} & {{a}_{1}}\left( x \right)=2/x, \\ & {{b}_{1}}\left( x \right)=1, \\ & {{a}_{n}}\left( x \right)={{a}_{n-1}}\left( x \right)\left( 1-4/{{x}^{2}} \right)+4{{b}_{n-1}}\left( x \right)/x, \\ & {{b}_{n}}\left( x \right)={{b}_{n-1}}\left( x \right)\left( 1-4/{{x}^{2}} \right)-4{{a}_{n-1}}\left( x \right)/x. \\ \end{align}$$

we can use, for example, $\tan^{-1}(1)=\pi/4$ by taking $x=1$. I hope this is an answer on your question.