Oldest series for pi

Here’s an interesting bit of history from Julian Havil’s new book The Irrationals. In 1593 Francois Vièta discovered the following infinite product for pi:

frac{2}{pi} = frac{sqrt{2}}{2}frac{sqrt{2+sqrt{2}}}{2}frac{sqrt{2 + sqrt{2+sqrt{2}}}}{2} cdots

Havil says this is “the earliest known.” I don’t know whether this is specifically the oldest product representation for pi, or more generally the oldest formula for an infinite sequence of approximations that converge to pi. Vièta’s series is based on the double angle formula for cosine.

The first series for pi I remember seeing comes from evaluating the Taylor series for arc tangent at 1:

frac{pi}{4} = 1 - frac{1}{3} + frac{1}{5} - frac{1}{7} + cdots

I saw this long before I knew what a Taylor series was. I imagine others have had the same experience because the series is fairly common in popular math books. However, this series is completely impractical for computing pi because it converges at a glacial pace. Vièta’s formula, on the other hand, converges fairly quickly. You could see for yourself by running the following Python code:

from math import sqrt

prod = 1.0
radic = 0.0

for i in range(10):
    radic = sqrt(2.0 + radic)
    prod *= 0.5*radic
    print 2.0/prod

After 10 terms, Vièta’s formula is correct to five decimal places.

Related posts: more sophisticated and efficient series for computing pi:

Computing pi with the AGM
Ramanujan series for pi
Algorithm for world record pi calculations

Tagged with: ,
Posted in Math
4 comments on “Oldest series for pi
  1. Joel says:

    It converges in fewer iterations, sure, but square roots are a pain to calculate without a computer. I wouldn’t be surprised if the arctangent method ends up being faster by hand.

  2. John says:

    I propose the following exercise for the readers. How many reciprocals do you suppose you could compute in the time it takes to compute a square root? Say it’s k = 100, or whatever number you prefer. Compute N terms of Vièta’s formula and k*N terms of the alternating harmonic series. Compare the results. The latter may be more accurate for small N (like N = 1), but at some point (depending on your value of k) the former will be more accurate.

    (Although there are lots of square root signs in Vièta’s formula, you only need to compute one new square root at each step since each new expression contains the previous expression, as in the code above.)

  3. Ed says:

    In A History of Pi Petr Beckmann states (pp. 94,95):

    “Second, Vièta was the first in history to represent pi by an analytical expression of an infinite sequence of algebraic operations”.

    and just a bit later:

    “Vièta’s expression, in fact, is the first known use of an infinite product, whether connected with pi or not”.

    and a few paragraphs later

    “Vièta himself did not use it for his calculation correct to 9 decimal places; he used the Archimedean method without substantial modifications by taking a polygon of 393,216 sides…”

  4. Kevin C. says:

    The “glacially slow” convergence of the alternating series makes it a nifty example to demonstrate acceleration techniques like Richardson Extrapolation For example, if you start with the approximations from 10, 20, 40, and 80 terms (the first three gotten for free while computing the fourth), then the individual estimates are all pretty far off (the 80 term estimate is 3.129…), but extrapolate three times and you get 3.14159274…

    (Certainly this is still nowhere near as fast as other techniques)

2 Pings/Trackbacks for "Oldest series for pi"
  1. [...] Cook has five posts on computing [...]