4
$\begingroup$

I have always wondered how the digits of π are calculated. How do they do it?

Pi records

Thanks.

  • 6
    Perhaps you should ask a question.2012-12-18
  • 1
    http://en.m.wikipedia.org/wiki/Chronology_of_computation_of_pi2012-12-18
  • 3
    If you had read beyond the (ignored) copyright license of the image you show and linked the [source](http://en.wikipedia.org/wiki/File:Record_pi_approximations.svg), you'd have immediately found Daryl's suggested link with detailled information (and a few others)2012-12-18
  • 0
    Here is Daryl's link for non-mobile browsers: http://en.wikipedia.org/wiki/Chronology_of_computation_of_pi2012-12-18

4 Answers 4

1

Here is one simple way to compute digits of $\pi$:

Recall that $\tan(\pi/4) = 1$.

Thus, we have $\arctan(1) = \pi/4$.

And, in particular, $4 \cdot \arctan(1) = \pi$.

You can now take the Taylor series expansion for $4 \cdot \arctan(x)$ and consider what happens when you evaluate it at $1$. Since the corresponding series (see, e.g., here) is an alternating series decreasing in absolute value, you can evaluate however many terms you want, and then take an evaluation of the next term as a (somewhat crude) bound for your error.

  • 4
    This is an insanely inefficient way to calculate $\pi$. Even if you have a calculator and only want to calculate 10 digits or so, it will take you forever.2012-12-18
  • 4
    I make no claims as to its efficiency; indeed, it takes about $700$ terms before you can accurately claim that the expansion begins $3.14\ldots$ I mention it strictly for its simplicity.2012-12-18
  • 0
    I took the liberty of editing your answer to give the series explicitly, and to point out how slow it is.2012-12-18
  • 0
    Suit yourself, but do take a read of http://math.stackexchange.com/faq#editing.2012-12-20
8

I don't know how we do nowadays, but there is a formula due David Bailey, Peter Borwein, and Simon Plouffe in 1995 which it can be used to calculate the $i^{th}$ digit of $\pi$ in base 16:

$$\pi=\sum ^{\infty} _i\frac {1}{16^i}\big(\frac 4 {8i+1}-\frac {2}{8i+4}-\frac {1}{8i+5}-\frac {1}{8i+6}\big)$$

What I find interesting is we don't need to know the previous digits to find the $i^{th}$ digit of $\pi$. Nowadays there are a lot of variations of that formula, but it was a surprise when this formula was discovered, because until that time, the mathematicians thought be impossible to find the $i^{th}$ digit of $\pi$ without knowing the previous ones.

  • 0
    where to put the n in formula2013-10-20
  • 0
    Are you sure this works on base 16? I just implemented a script that calculates this series and it plainly gives me a pretty good PI approximation in base 102014-10-07
6

From one of my favorite mathematicians,

$$ \frac{1}{\pi}=\frac{2\sqrt{2}}{9801}\sum_{k \ge 0} \frac{(4n)!(1103+26390n)}{(n!)^4396^{4n}}. $$

Looking here, we see some many formulae. Some of particular interest are:

$$ \pi=\sum_{k \ge 0}\frac{3^k-1}{4^k}\zeta(k+1),\quad \zeta(s)=\sum_{k\ge 0}k^{-s}. $$

$$ \frac{1}{6}\pi^2=\sum_{k \ge 1}\frac{1}{k^2} \quad \text{via the Basel problem}. $$

$$ \pi =\frac{3}{4}\sqrt{3}+24\int_0^{\frac{1}{4}}\sqrt{x-x^2}dx. $$

$$ \frac{\pi}{5\sqrt{\phi+2}}=\frac{1}{2}\sum_{k \ge 0}\frac{(k!)^2}{\phi^{2k+1}(2k+1)!},\quad \text{where } \phi \text{ is the golden ratio.} $$

$$ \pi=\frac{22}{7}-\int_{0}^{1}\frac{x^4(1-x)^4}{1+x^2}dx. $$

$$ \pi=4\sum_{1 \le k \le n}\frac{(-1)^{j+1}}{2j-1}+\frac{(-1)^n}{(2n-1)!}\sum_{i \ge 0}\frac{1}{16^i}\left( \frac{8}{(8i+1)_{2n}}-\frac{4}{(8i+3)_{2n}}-\frac{4}{(8i+4)_{2n}}-\frac{2}{(8i+5)_{2n}}+\frac{1}{(8i+7)_{2n}}+\frac{1}{(8i+8)_{2n}} \right),\quad \text{where } n \in \mathbb{Z}_{>0}, \text{ and } (x)_{n} \text{ represents the Pochhammer symbol.} $$

$$ \pi = 2\left[\prod_{n \ge 0}\left(1+\frac{\sin\left(\frac{1}{2}p_n\right)}{p_n}\right) \right]^{-1},\quad p_n \text{ is the } n\text{th} \text{ prime number}. $$

$$ \frac{2}{\pi}=\sqrt{\frac{1}{2}}\sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{\frac{1}{2}}}\sqrt{\frac{1}{2}+ \frac{1}{2}\sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{\frac{1}{2}}}}\cdots $$

$$ \frac{\pi}{2}=\prod_{n \ge 1}\frac{(2n)^2}{(2n-1)(2n+1)}. $$

  • 0
    Which mathematician?2012-12-18
  • 0
    @asmeurer Ramanujan. :-)2012-12-19
4

The Chudnovsky algorithm, which just uses the very rapidly converging series $$\frac{1}{\pi} = 12 \sum^\infty_{k=0} \frac{(-1)^k (6k)! (13591409 + 545140134k)}{(3k)!(k!)^3 640320^{3k + 3/2}},$$ was used by the Chudnovsky brothers, who are some of the points on your graph.

It is also the algorithm used by at least one arbitrary precision numerical library, mpmath, to compute arbitrarily many digits of $\pi$. Here is the relevant part of the mpmath source code discussing why this series is used, and giving a bit more detail on how it is implemented (and if you want, you can look right below that to see exactly how it is implemented). It actually uses a method called binary splitting to evaluate the series faster.

  • 0
    One thing I'm not sure about: the mpmath source says that each term adds roughly 14 digits, but it's not clear if it's 14 more digits of $\pi$ or 14 more digits of $\frac{1}{\pi}$.2012-12-18
  • 0
    I'm not sure, but I would go with $\frac{1}{\pi}$ since the terms of the _series_ are being implicitly referred to.2012-12-18