Gauss–Legendre Algorithm
   HOME

TheInfoList



OR:

The Gauss–Legendre algorithm is an
algorithm In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
to compute the digits of . It is notable for being rapidly convergent, with only 25 iterations producing 45 million correct digits of . However, it has some drawbacks (for example, it is
computer memory Computer memory stores information, such as data and programs, for immediate use in the computer. The term ''memory'' is often synonymous with the terms ''RAM,'' ''main memory,'' or ''primary storage.'' Archaic synonyms for main memory include ...
-intensive) and therefore all record-breaking calculations for many years have used other methods, almost always the Chudnovsky algorithm. For details, see Chronology of computation of . The method is based on the individual work of
Carl Friedrich Gauss Johann Carl Friedrich Gauss (; ; ; 30 April 177723 February 1855) was a German mathematician, astronomer, geodesist, and physicist, who contributed to many fields in mathematics and science. He was director of the Göttingen Observatory and ...
(1777–1855) and Adrien-Marie Legendre (1752–1833) combined with modern algorithms for multiplication and
square root In mathematics, a square root of a number is a number such that y^2 = x; in other words, a number whose ''square'' (the result of multiplying the number by itself, or y \cdot y) is . For example, 4 and −4 are square roots of 16 because 4 ...
s. It repeatedly replaces two numbers by their
arithmetic Arithmetic is an elementary branch of mathematics that deals with numerical operations like addition, subtraction, multiplication, and division. In a wider sense, it also includes exponentiation, extraction of roots, and taking logarithms. ...
and
geometric mean In mathematics, the geometric mean is a mean or average which indicates a central tendency of a finite collection of positive real numbers by using the product of their values (as opposed to the arithmetic mean which uses their sum). The geometri ...
, in order to approximate their arithmetic-geometric mean. The version presented below is also known as the Gauss–Euler, Brent–Salamin (or Salamin–Brent) algorithm; it was independently discovered in 1975 by Richard Brent and Eugene Salamin. It was used to compute the first 206,158,430,000 decimal digits of on September 18 to 20, 1999, and the results were checked with Borwein's algorithm.


Algorithm

# Initial value setting: a_0 = 1\qquad b_0 = \frac\qquad p_0 = 1\qquad t_0 = \frac. # Repeat the following instructions until the difference between a_ and b_ is within the desired accuracy: \begin a_ & = \frac, \\ \\ b_ & = \sqrt, \\ \\ p_ & = 2p_n, \\ \\ t_ & = t_n - p_n(a_-a_)^2. \\ \end # is then approximated as: \pi \approx \frac. The first three iterations give (approximations given up to and including the first incorrect digit): :3.140\dots :3.14159264\dots :3.1415926535897932382\dots :3.14159265358979323846264338327950288419711\dots :3.141592653589793238462643383279502884197169399375105820974944592307816406286208998625\dots The algorithm has quadratic convergence, which essentially means that the number of correct digits doubles with each
iteration Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. Each repetition of the process is a single iteration, and the outcome of each iteration is then the starting point of the next iteration. ...
of the algorithm.


Mathematical background


Limits of the arithmetic–geometric mean

The arithmetic–geometric mean of two numbers, a0 and b0, is found by calculating the limit of the sequences :\begin a_ & = \frac, \\ pt b_ & = \sqrt, \end which both converge to the same limit.
If a_0=1 and b_0=\cos\varphi then the limit is where K(k) is the
complete elliptic integral of the first kind In integral calculus, an elliptic integral is one of a number of related functions defined as the value of certain integrals, which were first studied by Giulio Carlo de' Toschi di Fagnano, Giulio Fagnano and Leonhard Euler (). Their name originat ...
:K(k) = \int_0^ \frac. If c_0 = \sin\varphi, c_ = a_i - a_, then :\sum_^\infty 2^ c_i^2 = 1 - where E(k) is the complete elliptic integral of the second kind: :E(k) = \int_0^\sqrt \; d\theta Gauss knew of these two results. Salamin, Eugene, ''Computation of pi'', Charles Stark Draper Laboratory ISS memo 74–19, 30 January 1974, Cambridge, Massachusetts


Legendre’s identity

Legendre proved the following identity: :K(\cos \theta) E(\sin \theta ) + K(\sin \theta ) E(\cos \theta) - K(\cos \theta) K(\sin \theta) = , for all \theta.


Elementary proof with integral calculus

The Gauss-Legendre algorithm can be proven to give results converging to \pi using only integral calculus. This is done here and here.


See also

* Numerical approximations of


References

{{DEFAULTSORT:Gauss-Legendre algorithm Pi algorithms