Generated by DeepSeek V3.2| Gauss–Legendre algorithm | |
|---|---|
| Name | Gauss–Legendre algorithm |
| Class | Iterative algorithm |
| Data structure | N/A |
| Time | Quadratic convergence |
| Space | Constant |
| Discovered by | Carl Friedrich Gauss, Adrien-Marie Legendre |
| Year | 19th century |
Gauss–Legendre algorithm. The Gauss–Legendre algorithm is an iterative method for rapidly computing the mathematical constant π. Independently discovered by Carl Friedrich Gauss and Adrien-Marie Legendre in the late 18th and early 19th centuries, it is based on the arithmetic-geometric mean and exhibits extraordinarily fast quadratic convergence. Each iteration approximately doubles the number of correct digits, making it a foundational algorithm in the history of high-precision computational mathematics.
The algorithm computes π through a sequence of iterative updates involving the arithmetic-geometric mean, a concept deeply studied by Gauss in his work on elliptic integrals. Initial values are set for variables representing arithmetic and geometric means, alongside an auxiliary variable. With each cycle, these values are recalculated, and the approximations for π are generated from their combination. This process was a landmark in pre-computer number theory, and its rediscovery in the 20th century, notably by Eugene Salamin and Richard Brent, propelled it to prominence in digital computation. The method's efficiency made it the first algorithm used to set records for calculating π to millions of digits on systems like the CDC 7600 at Lawrence Berkeley National Laboratory.
The procedure initializes four real numbers: \(a_0 = 1\), \(b_0 = 1 / \sqrt{2}\), \(t_0 = 1/4\), and \(p_0 = 1\). For \(n \geq 0\), the iterations proceed as defined by the following recurrence relations, which are derived from properties of the arithmetic-geometric mean and complete elliptic integrals of the first kind: \[ a_{n+1} = \frac{a_n + b_n}{2}, \quad b_{n+1} = \sqrt{a_n b_n}, \quad t_{n+1} = t_n - p_n (a_n - a_{n+1})^2, \quad p_{n+1} = 2 p_n. \] An approximation for π is then given by the limit: \[ \pi \approx \frac{(a_n + b_n)^2}{4 t_n}. \] The derivation connects deeply to the work of Gauss on the lemniscate constant and the Landen's transformation, with the auxiliary variable \(t\) tracking a specific integral form. This formulation was elegantly reformulated in the 1976 paper by Eugene Salamin.
The algorithm converges quadratically, meaning the number of correct decimal digits roughly doubles with each iteration. This is exceptionally fast compared to classical series like those developed by John Machin or the Leibniz formula for π. The convergence proof relies on the theory of modular forms and the rapid convergence of the arithmetic-geometric mean sequence. Typically, only three or four iterations are required to achieve over a million digits of precision, a property that made it revolutionary for computations at institutions like the Tokyo University.
In terms of digit operations, the algorithm has a time complexity of \(O(M(n) \log n)\) when using fast multiplication algorithms like the Schönhage–Strassen algorithm or the later Fürer's algorithm, where \(M(n)\) is the cost of multiplying \(n\)-digit numbers. Its space complexity is linear in the number of digits. This efficiency allowed it to be used in early record-setting calculations, such as those performed on the Cray supercomputers, and it was eventually superseded by even faster algorithms like the Chudnovsky algorithm and the Borwein's algorithm.
The mathematical foundation was laid in the 1790s by Carl Friedrich Gauss through his investigations into the arithmetic-geometric mean and its relation to elliptic integrals, as recorded in his personal diary and later published in *Werke*. Adrien-Marie Legendre independently explored similar relations in his treatise *Exercices de Calcul Intégral*. The algorithm in its modern computational form, however, remained obscure until its independent rediscovery in 1976 by Eugene Salamin and, shortly after, by Richard Brent. This revival coincided with the dawn of high-precision computing, leading to its implementation in major projects like the Y-cruncher software and calculations at NASA.
Beyond setting records for π calculation, the algorithm's underlying arithmetic-geometric mean is crucial in fast evaluations of elliptic integrals and elliptic functions, with applications in physics and engineering. It influenced the development of the AGM method for computing logarithms and exponential functions. The algorithm's discovery marked a pivotal moment in computational mathematics, demonstrating how classical number theory could yield supremely efficient modern algorithms. It paved the way for subsequent work by the Borwein brothers and remains a celebrated example in the field, taught in courses on numerical analysis worldwide. Category:Pi algorithms Category:Iterative methods Category:Numerical analysis