Current Article  

Gauss-Legendre algorithm

The Gauss-Legendre algorithman algorithmcomputedigitsPi.

The methodbased onindividual workCarl Friedrich Gauss (1777 - 1855)Adrien-Marie Legendre (1752-1833) combinedmodern algorithmsmultiplicationsquare roots. It repeatedly replaces two numbers by their arithmeticgeometric mean,orderapproximate their arithmetic-geometric mean.

The version presented belowalso known asSalamin-Brent algorithm;was independently discovered1976 by Eugene SalaminRichard Brent. It was usedcomputefirst 206,158,430,000 decimal digitsPi on September 1820, 1999, andresults were checkedBorwein's algorithm.

1. Initial value setting;

a = 1, b = 1 / √22, t = 1/4, p = 1

2. Repeatfollowing instructins untildifference ofand bwithindesired accuracy:

x = (a+b) / 2
y = √(a*b)
t = t - p * (a-x)2
a = x
b = y
p = 2 * p

3. Piapproximateda, bt as:

Pi ≈ (a+b)2 / (4*t)

The algorithm has second order convergent nature, which essentially means thatnumbercorrect digits doubleseach step ofalgorithm.

Copyright 2004. All rights reserved.