# Calculating pi

.

Then:

for

for

for

This remarkable iteration comes from Borwein and Borwein’s “Pi and the AGM“; this is the first formula for of the many in the book. It is based on the arithmetic-geometric mean, which is defined as follows:

Given define the sequences by and for all

.

It can be shown that these sequences both converge to the same value, called the arithmetic-geometric mean of and , and denoted

.

The derivation of the iteration above starts with the complete elliptic integral of the first kind:

The importance of these integrals for the AGM includes the useful result

.

It can also be shown that:

and that

(In these results, the upper dot indicates the derivative. It is conventional to write for but to keep the symbols down I won’t use that here.) Finally, and this is the basis for the iteration:

.

Full details are given in the book above.

Now, let’s see this in operation. Using Maxima, with floating point precision set at 200 digits; we start with:

```(%1) fpprec:200; (%i2) [x,y,pi]:bfloat([sqrt(2),2^(1/4),2+sqrt(2)])latex pilatex pilatex pi\$, including one which exhibits quintic convergence; that is, the number of correct digits multiplies by five at each step. To find that you'll have to read their book...```

``` Share this:Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window)Click to share on Google+ (Opens in new window) Related ```
``` ```
``` ```
``` Post navigation Previous Post Previous post: Next Post Next Post: 2 thoughts on “Calculating pi” mvngu says: May 18, 2008 at 9:33 pm Possible typo? > the number of correct digits multiples by five at each step. > the number of correct digits multiplies by five at each step. Reply Jake says: May 20, 2008 at 10:47 pm Wow, I just added Brent-Salamin to my blog … then took a look at yours. Your algorithm looks very similar to mine, though seems simpler? Reply Leave a Reply Your email address will not be published. Required fields are marked * Notify me of follow-up comments by email. Notify me of new posts by email. ```