Improved approximations for the perimeter of an ellipse

Primarily AI-generated textHuman understanding: some partsmath.CA — Classical Analysis and ODEsmath.NA — Numerical Analysis

Contributed by Mika Inki ↗

Version 1 / Nov 27, 2026 / CC BY 4.0

Abstract

We give three closed formulas, with three, four and six square roots, for the perimeter PP of an ellipse with semi-axes a≥b≥0a\ge b\ge0. In exact arithmetic their maximum relative errors over all eccentricities, 4.0×10−84.0\times10^{-8}, 4.1×10−174.1\times10^{-17} and 8.1×10−378.1\times10^{-37}, lie below the unit roundoff of single, double and quadruple precision, respectively, and evaluated in that precision they are accurate to within about six units of it (for quadruple precision, as estimated with 3434-digit decimal arithmetic). Each formula writes a fixed number of steps of the arithmetic--geometric mean (AGM) as one expression, in a form that avoids the harmful cancellation. For flat ellipses, where any fixed number of AGM steps eventually fails (as b→0b\to0 it tends to 2πa2\pi a instead of 4a4a), it switches to an approximation based on Legendre's relation, which expresses the complete elliptic integral EE of the second kind exactly through the integral KK of the first kind and two power series in b/ab/a: the AGM steps supply an estimate of KK, and the series are truncated to short polynomials. A final term makes the formula continuous at the switch, and we give the range of its coefficient that suffices for each precision. We prove that for every switch point and every accuracy there are such continuous formulas, and that the error of the continuous formula is at most that of the AGM branch plus twice that of the flat-ellipse branch. The formulas are exact at b=0b=0 and at b=ab=a; numerically, they are increasing in bb and more accurate than Ramanujan's second approximation at every eccentricity, by factors of at least 289289, 2.8×10112.8\times10^{11} and 4.1×10324.1\times10^{32}. With the latency of three, four or six AGM steps, they are faster than an AGM loop of the same accuracy for flat ellipses, where the loop needs more steps. We also study nested-radical generalisations P≈π(a+b)(1+3h/D)P\approx\pi(a+b)(1+3h/D) of Ramanujan's second approximation, with h=((a−b)/(a+b))2h=((a-b)/(a+b))^2 and DD a constant plus nested square roots of a polynomial in hh. Ramanujan's formula is a degenerate member of a one-parameter family of double-nested forms that agree with the Gauss--Kummer series through h4h^4. We derive double- and triple-nested formulas with integer coefficients and double-, triple- and quadruple-nested formulas with real coefficients: formulas that are, as verified numerically, nowhere less accurate than Ramanujan's, formulas that agree with the series to the highest order possible for their depth, and minimax formulas. The best of them reduce the maximum error of Ramanujan's formula by up to five orders of magnitude. We also give a numerically stable evaluation in powers of 1−h1-h, tabulate the errors of all formulas at seven eccentricities where the perimeter has a closed form, and compare their cost with that of the AGM in double and single precision.

Provenance statement

The results were obtained with the assistance of Claude Opus 5.5, working under the direction of the author. The model derived the AGM-based formulas and Proposition 4.1 with its proof, carried out the series computations behind the propositions, the searches for integer and real-coefficient formulas, the optimisations, the high-precision verification and the cost estimates, produced the figures, drafted the text and checked the references. The computations were done in Python, in exact rational arithmetic, in arbitrary-precision decimal arithmetic with up to 110 digits, and in native or exactly emulated binary32 and binary64 floating-point arithmetic. I largely understand the principles used in deriving the formulas and I have manually tested some of the formulas in GNU Octave. I initially suggested many of the basic approaches used, and the model then much refined them and added further ideas.

Tools used

Anthropic
Claude OpusVersion 5.5

References

  1. M. Abramowitz and I. A. Stegun (eds.), Handbook of Mathematical Functions , Nat. Bur. Standards Appl. Math. Ser. 55, Washington, 1964.
  2. S. Adlaj, An eloquent formula for the perimeter of an ellipse , Notices Amer. Math. Soc. 59 (2012), no. 8, 1094--1099. 10.1090/noti879DOI
  3. G. Almkvist and B. C. Berndt, Gauss, Landen, Ramanujan, the arithmetic-geometric mean, ellipses, π\pi, and the Ladies Diary , Amer. Math. Monthly 95 (1988), no. 7, 585--608. 10.2307/2323302DOI
  4. S. E. Ayala-Raggi and M. Rendón-Marín, Is simplicity still possible for a more accurate approximation to the perimeter of the ellipse? or, Using the exponential function to further improve the second Ramanujan's approximation , preprint arXiv:2510.16191 (https://arxiv.org/abs/2510.16191), 2025.arXiv
  5. S. E. Ayala-Raggi and M. Rendón-Marín, Approximating the ellipse perimeter by ``bending the line'': the ELIP closed-form family , preprint arXiv:2610.28689 (https://arxiv.org/abs/2610.28689), 2026.arXiv
  6. G. A. Baker, Jr. and P. Graves-Morris, Padé Approximants , 2nd ed., Encyclopedia Math. Appl. 59, Cambridge University Press, Cambridge, 1996.
  7. R. W. Barnard, K. Pearce and L. Schovanec, Inequalities for the perimeter of an ellipse , J. Math. Anal. Appl. 260 (2001), no. 2, 295--306. 10.1006/jmaa.2000.7128DOI
  8. J. M. Borwein and P. B. Borwein, Pi and the AGM: A Study in Analytic Number Theory and Computational Complexity , Wiley, New York, 1987.
  9. R. P. Brent, Fast multiple-precision evaluation of elementary functions , J. ACM 23 (1976), no. 2, 242--251. 10.1145/321941.321944DOI
  10. B. C. Carlson, Numerical computation of real or complex elliptic integrals , Numer. Algorithms 10 (1995), no. 1, 13--26. 10.1007/BF02198293DOI
Show all 31 referencesShow fewer references
  1. B. C. Carlson, Elliptic integrals , Chapter 19 of the NIST Digital Library of Mathematical Functions , https://dlmf.nist.gov/19.link
  2. S. Chowla and A. Selberg, On Epstein's zeta-function , J. Reine Angew. Math. 227 (1967), 86--110. 10.1515/crll.1967.227.86DOI
  3. W. J. Cody, Chebyshev approximations for the complete elliptic integrals KK and EE , Math. Comp. 19 (1965), no. 89, 105--112; Corrigendum, ibid. 20 (1966), no. 93, 207. 10.1090/S0025-5718-1965-0171370-4DOI
  4. A. Fog, Instruction tables: Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD and VIA CPUs , Technical University of Denmark, https://www.agner.org/optimize/.link
  5. T. Fukushima, Fast computation of complete elliptic integrals and Jacobian elliptic functions , Celest. Mech. Dyn. Astron. 105 (2009), 305--328. 10.1007/s10569-009-9228-zDOI
  6. T. Fukushima, Precise and fast computation of the general complete elliptic integral of the second kind , Math. Comp. 80 (2011), no. 275, 1725--1743. 10.1090/S0025-5718-2011-02455-5DOI
  7. T. Fukushima, Precise and fast computation of complete elliptic integrals by piecewise minimax rational function approximation , J. Comput. Appl. Math. 282 (2015), 71--76. 10.1016/j.cam.2014.12.038DOI
  8. C. Hastings, Jr., Approximations for Digital Computers , Princeton University Press, Princeton, 1955.
  9. IEEE Standard for Floating-Point Arithmetic , IEEE Std 754-2019, 2019. 10.1109/IEEESTD.2019.8766229DOI
  10. J. Ivory, A new series for the rectification of the ellipsis; together with some observations on the evolution of the formula (a2+b2−2abcos⁡θ)n(a^2+b^2-2ab\cos\theta)^n , Trans. Roy. Soc. Edinburgh 4 (1798), 177--190. 10.1017/S0080456800030817DOI
  11. Th. Kaluza, Über die Koeffizienten reziproker Potenzreihen , Math. Z. 28 (1928), 161--170. 10.1007/BF01181155DOI
  12. E. E. Kummer, Über die hypergeometrische Reihe , J. Reine Angew. Math. 15 (1836), 39--83 and 127--172. 10.1515/crll.1836.15.39, 10.1515/crll.1836.15.127DOI
  13. P. Moscato and A. Ciezak, A new approximation for the perimeter of an ellipse , Algorithms 17 (2024), no. 10, 464. 10.3390/a17100464DOI
  14. M. J. D. Powell, Approximation Theory and Methods , Cambridge University Press, Cambridge, 1981.
  15. S. Ramanujan, Modular equations and approximations to π\pi , Quart. J. Pure Appl. Math. 45 (1914), 350--372.
  16. E. Salamin, Computation of π\pi using arithmetic-geometric mean , Math. Comp. 30 (1976), no. 135, 565--570. 10.2307/2005327DOI
  17. U. Shankar, Perimeter of an ellipse: understanding Ramanujan's approximation , preprint arXiv:2603.03373 (https://arxiv.org/abs/2603.03373), 2026.arXiv
  18. M. Parker (Stand-up Maths), Why is there no equation for the perimeter of an ellipse , YouTube video, 5 September 2020, https://www.youtube.com/watch?v=5nW3nJhBHL0.link
  19. S. Sýkora, Approximations of ellipse perimeters and of the complete elliptic integral E(x)E(x): review of known formulae , Stan's Library, Vol. I, 2005. 10.3247/SL1Math05.004DOI
  20. S. Sýkora, Advances in approximations of ellipse perimeters and of the complete elliptic integral , Stan's Library, Vol. II, 2007.
  21. M. B. Villarino, Ramanujan's perimeter of an ellipse , preprint arXiv:math/0506384 (https://arxiv.org/abs/math/0506384), 2005.arXiv

Version history

  1. v1 · 29 pagesSubmitted by Mika InkiInitial depositCurrentNov 26, 2026