The Gauss–Brent–Salamin formula for π #
Gauss's theorem expresses K(k) by the AGM M(1, k′), the AGM evaluation of the second kind
expresses E(k) / K(k) by the squared AGM corrections, and Legendre's relation ties the
complete integrals at complementary moduli k and k′ = √(1 - k²) to π / 2. Combined, they
express π by two AGM iterations alone:
TauCeti.Real.pi_eq_four_mul_agm_mul_agm_div_one_sub_tsum: forx, y > 0withx² + y² = 1, Salamin's formulaπ = 4 M(1, x) M(1, y) / (1 - ∑ 2ʲ (cⱼ(x)² + cⱼ(y)²));TauCeti.Real.pi_eq_four_mul_agm_sq_div_one_sub_tsum: the self-complementary casex = y = 1 / √2, the Gauss–Brent–Salamin formulaπ = 4 M(1, 1/√2)² / (1 - ∑_{j ≥ 1} 2^(j+1) cⱼ²).
Here cⱼ² = aⱼ² - gⱼ² for the AGM iteration a₀ = 1, g₀ = x, with j ≥ 1. Mathlib's
NNReal.agmSequences 1 x n is the pair (gₙ₊₁, aₙ₊₁), so its index n corresponds to the
classical index j = n + 1. Truncating the series and the AGM after finitely many steps gives
the Brent–Salamin algorithm for computing π.
References #
- E. Salamin, Computation of π using arithmetic-geometric mean, Math. Comp. 30 (1976), 565–570.
- R. P. Brent, Fast multiple-precision evaluation of elementary functions, J. ACM 23 (1976), 242–251.
- J. M. Borwein and P. B. Borwein, Pi and the AGM, Wiley, 1987, §2.4.
Salamin's formula for complementary moduli: if x, y > 0 and x² + y² = 1, then
π = 4 M(1, x) M(1, y) / (1 - ∑ₙ 2ⁿ⁺¹ (cₙ₊₁(x)² + cₙ₊₁(y)²)), where M is the AGM and
cₙ₊₁(x)² = aₙ₊₁² - gₙ₊₁² is the squared correction of the AGM iteration started at (1, x).
Mathlib's agmSequences 1 x n is the pair (gₙ₊₁, aₙ₊₁).
The Gauss–Brent–Salamin formula: with the AGM iteration a₀ = 1, g₀ = 1 / √2 and
cⱼ² = aⱼ² - gⱼ², π = 4 M(1, 1/√2)² / (1 - ∑_{j ≥ 1} 2^(j+1) cⱼ²). Mathlib's
agmSequences 1 (√2)⁻¹ n is the pair (gₙ₊₁, aₙ₊₁), so the series index is n = j - 1.