home | index | units | counting | geometry | algebra | trigonometry & functions | calculus
analysis | sets & logic | number theory | recreational | misc | nomenclature & history | physics

Final Answers
© 2000-2005 Gérard P. Michon, Ph.D.

Perimeter of an Ellipse

An abridged version of our general overview may still be found at its original location.

Related topics on this website include:

Related Links (Outside this Site)

Ellipse  by  Dr. James B. Calvert, University of Denver (Colorado).
Circumference of an Ellipse by Robert L. Ward in "MathForum@Drexel".
New Approximation for [the] Perimeter of an Ellipse by David W. Cantrell.
Two New Approximations, in a Certain Form, for the Perimeter of an Ellipse
Modifying Ramanujan's Second Approximation for the Perimeter of an Ellipse
Perimeter of an Ellipse  by  Stanislav Sýkora.
 

Circumference of an Ellipse


 Ellipse (Jaleigh. B. of Minonk, IL. 2000-11-26 twice)
What is the formula for the perimeter of an ellipse? [oval]
(S. H. of United Kingdom. 2001-01-25)
What is the formula for the circumference of an ellipse?

There is no simple exact formula:  There are simple formulas but they are not exact, and there are exact formulas but they are not simple.  Here, we'll discuss more than a dozen approximations, and 3 or 4 exact expressions (infinite sums).

The complementary convergence properties of two such sums may be used to compute  efficiently  the perimeter of any ellipse with arbitrary precision, using one series for eccentricities below 0.96 [say] and the other one above that.


If the ellipse is of equation   x2/a2 + y2/b2 = 1   with a>b,   a is called the major radius, and b is the minor radius. The quantity e = Ö(1-b2/a2) is the eccentricity of the ellipse.  The quantity h = (a-b)2/(a+b)2 also appears in some formulas.

 Exact

An exact expression of the perimeter P of an ellipse was first published in 1742, by Colin Maclaurin (1698-1746).  It involves the sum of infinitely many terms of the form [-1 / (2n-1)] ´ [(2n)! / (2n n!)2 ] 2 e2n The first such term (for n = 0) is equal to 1, whereas all the others are negative correction terms :

P/2pa = 1 - [1/4]e2 - [3/64]e4 - [5/256]e6 - [175/16384]e8 - [441/65536]e10 ...

      Observe that this exact expression for the perimeter of an ellipse gives the circumference of a circle (e = 0), as 2p times its radius (a).  Although this power series gives the perimeter of any ellipse with arbitrary precision, a better series exists which converges faster... 
      Still, the convergence of either of these is far too slow when the eccentricity (e) is almost 1...  Yet another series must be used then.
      For a few nice approximative formulas to use in a pinch, read on:

The following quadratic formula is often badly butchered to the point that only a vague typographical resemblance remains (see also below for a very similar formula (6) which generalizes this one). It is found in dictionaries and other practical references as a simple approximation to the perimeter P of the ellipse:

(1)
P  »  p Ö2(a2+b2) - (a-b)2/2

This is a good approximation whose accuracy may be determined by expanding it as a power series of the eccentricity e [since b = aÖ(1-e2) ] which may be compared to the correct expansion given above. Here is what P/2pa would be, according to this first approximative formula:

1 - [1/4]e2 - [3/64]e4 - [5/256]e6 - [89/8192]e8 - [231/32768]e10 ...

The first 4 terms are correct!  Furthermore, the fifth and sixth terms amount to a difference of only -3e8/16384(1+7e2/4) (the approximative formula always underestimates the true value). The relative error is the ratio of this discrepancy to the whole sum, adequately represented by its first two terms, and is thus very close to -3e8/16384(1+2e2).  Therefore, if you use the formula to compute the length of the Earth Meridian (considering it to be a perfect ellipse of eccentricity e = 0.081819191...), you will make a relative error of about  3.727´10-13 which amounts to less than 15 mm over the entire circumference of the Meridian; just about about one tenth the width of a human hair!

In 1914, the Indian mathematician S. Ramanujan (1887-1920) came up with a better approximative formula, which is just about as simple as the above one, but is two (!) orders of magnitude more accurate, namely:

(2)
P » p [ 3(a+b) - Ö (3a+b)(a+3b)  ]    =   p (a+b) [ 3 - Ö 4-h ]

Remarkably, the first 6 terms (!) of the power series for this formula (with respect to e) coincide with the corresponding terms in the exact expansion given above. It's only with the coefficient of e12 that things start to differ slightly: The correct coefficient of e12 is -4851/220 whereas Ramanujan's formula gives -9703/221, for a discrepancy approximately equal to -e12/221 Using one more term in each expansion, we find an absolute discrepancy of -e12/221 [ 1 + 11e2/4 ] , which translates into a relative error extremely close to -e12/221 [ 1 + 3e2 ] . For an ellipse of the same eccentricity as the Earth Meridian, such a relative error is only about 4.38´10-20. For an ellipse the size of the Earth's Meridian, this would mean a ludicrous precision of 1.75 pm (pm = picometer), or about one sixtieth of the conventional diameter of an hydrogen atom (which is twice the Bohr radius)!

Ellipses of low eccentricities are thus well taken care of, by either of the above approximations (Ramanujan's formula is always much better).  Such is not the case for very elongated ellipses (when the eccentricity e is very close to 1):  We know the correct perimeter in this case, since the entire circumference essentially collapses down to two segments of length 2a each. Therefore,

P = 4a   for a flat ellipse.   [A degenerate ellipse.]

For such a flat ellipse, our first approximative formula would give P=[6/2]a or about 3.84765 a, which is roughly 3.8% below the correct value. (barely adequate for a rough estimate). Ramanujan's formula estimates the perimeter of a flat ellipse at p (3-Ö3) a or about 3.983379868 a (instead of 4a) for a relative error of about -0.4155 %. For very elongated ellipses, Ramanujan's formula is thus about 10 times better than our first approximation and may be somewhat acceptable in practice, although the error figure remains unimpressive.

The above Ramanujan formula is only about twice as precise as a formula (proposed by Lindner between 1904 and 1920) which is obtained simply by retaining only the first three terms in an exact expansion [given below] in terms of h (these three terms happen to form a perfect square). Lindner's formula estimates the perimeter of a flat ellipse with a relative error of about -0.598 % :

(  )

P » p (a+b) [ 1 + h/8 ] 2

A better 1914 formula, also due to Ramanujan, gives the perimeter of flat ellipses with the exact same precision obtained when using 7/22 to approximate 1/p (an error of about -0.04% which is 10 times better than Ramanujuan's first formula). Ramanujan's second formula is expressed in terms of  h = (a-b)2/(a+b)2 :

(3)
P » p (a+b) [ 1 + 3h / ( 10+Ö4-3h  ) ]

Following our established pattern, we may expand this formula as a power series of e2. This is a religious experience! All the terms match the correct series up to and including the coefficient of e18...  It takes some bravery to work out a precise expression for the relative error involved.  Here it is:

(-3 / 237 ) e20   [ 1 + 5 e2 + 11107/768 e4 + 4067/128 e6 + 3860169/65536 e8 + ... ]

This would amount to a relative error of about -4´10-33 for the perimeter of an ellipse similar to the Earth Meridian. That's way beyond comparison with any available physical yardstick: The physical Universe (the one we live in) is thought to lack any smoothness at the Planck Scale, where dimensions are on the order of the Planck Length, a unit roughly equal to 1.616´10-35 m. The accuracy of Ramanujan's (second) formula is still about 100 million times coarser than this. However, that may not be much in view of the fact that ordinary geometry surely breaks down in the physical Universe well before the Planck realm is reached...

The orbit of the Earth around the Sun is an ellipse about 23 500 times as large as the Meridian, but it is much rounder (its eccentricity is roughly 5 times smaller: e = 0.016718 at epoch 1980.0). Therefore, the second Ramanujan formula estimates the perimeter of a perfect ellipse similar to Earth's orbit with a relative error of about -6.5´10-44, which translates into an error slightly less than 3800 times the Planck length.

In 1917, Hudson came up with a formula without square roots, which is intermediate in precision between the two Ramanujan formulas. It yields a relative error of about -0.19% for flat ellipses and a relative error for low eccentricities which equals (-9/230 ) e16 [ 1 + 4 e2 + 229/24 e4 + ... ] (that's about 3.47´10-26 for the Earth Meridian, corresponding to 1.4 attometer). Hudson's formula is traditionally expressed in terms of the quantity L = h/4 = (a-b)2/[2(a+b)]2 :

(4)
 
P » p (a+b)/4 [ 3(1+L) + 1/(1-L) ]   =   p (a+b
 
64 - 3 h2
Vinculum
64 - 16 h
This formula appears without attribution in "A Manual of Mathematics" by Ralph G. Hudson and Joseph Lipka, which contains material first published in 1917.  The traditional attribution to Hudson and/or the 1917 date are somewhat questionable, since all we know (so far) is that the formula appears on page 17 of the 1955 sixth printing (thanks to David W. Cantrell, who had a hunch and took the trouble to check).  Please, let us know if you can help with this...

Hudson's formula involves a rational function of h called a Padé approximant, namely the ratio of two polynomials (of degrees p and q) whose Taylor expansion matches the Taylor expansion of the target function  f  up to order  p + q.  (The exact expansion of f as a power series of h is given below.)

A more precise Padé approximant consists of the optimized ratio of two quadratic polynomials of h and leads to the following formula, credited to Jacobsen and Waadeland (1985). This expression gives a relative error for the perimeter of a round ellipse (low e) roughly equal to -33 e20/238 and a relative error of about -0.0888 % for a flat ellipse. This is directly comparable with the accuracy of Ramanujan's second formula (3), which is 5.5 times better for the circumference of a round ellipse [and about 2.2 times better for a flat ellipse]:

(  )
 
P » p (a+b)  
 
256 - 48 h - 21 h2
Vinculum
256 - 112 h + 3 h2

Other Padé approximant formulas of precision either lesser than Hudson's or better than Jacobsen's are discussed below.

Hudson's formula (4) is one of only two circumference formulas quoted in the Handbook of Bronshtein and Semendyayev.  The other is merely a linear combination of the arithmetic and geometric mean formulas (8 and 10) optimized for an ellipse of low eccentricity.  This combination was proposed by Peano in 1889.  It has about the same accuracy as our first quadratic formula (1) for a roundish ellipse [except that the error is positive instead of negative], but it is almost 5 times worse (+17.8 %) in the flat case. We are told that the relative error of this formula has been shown not to exceed   0.4 e8/(1-e2) :

(  )
vinculum vinculum
P » p [ 3(a+b)/2 - Ö ab ]   =   p (a+b) [ 3 - Ö 1-h ] / 2

The following so-called "YNOT formula" was first proposed by Roger Maertens:

(5)

P » 4 (ay+by) 1/y   or   P » 4a (1 + (1-e2)y/2 )1/y   with   y = ln(2)/ln(p/2)

For any value of y, this expression would be exact for flat ellipses (P = 4a), but it's only correct for circles (e = 0) if y has the nominal value of ln(2)/ln(p/2), which is known as the "YNOT constant" (equal to 1.5349285356613752...).  The relative error of the YNOT formula is always less than 0.3619%  The worst-case aspect ratio for the 
 YNOT formula. Error is about 0.362 % (the maximum relative error is for the circumference of an ellipse whose eccentricity is about 0.979811, which means an ellipse [ pictured at right ] with a minor axis very slightly less than one fifth of its major axis). For small values of e, the relative error of the YNOT formula is about (2y-3)e4/64 [1+e] . Since (2y-3)/64 is a low coefficient (about 0.0010915), this is more than adequate in practice, although the relative error for an ellipse of low eccentricity is far less impressive than with any of the formulas discussed so far (the YNOT formula overestimates the circumference of the Earth Meridian by about 2 meters).

This idea may well have occurred to a number of other people...  The YNOT formula may have been first published as a special case of a formula given in 1959 by Necat Tasdelen (a Turkish engineer who brought the fact to our attention himself, by e-mail, on 2002-10-02).

Other circumference formulas have been proposed to minimize the relative error on some extended range of eccentricities.  The most popular such efforts revolve around a simple quadratic expression generalizing our first formula (1):

(6)
P » pÖ 2(a2+b2) - (a-b)2/D     =   p (a+b) Ö 1 + h (1-1/D)

As shown above, D = 2 is optimal for low eccentricities.  On the other hand, a D of about 2.63949 [more precisely, p2/(2p2-16) ] is optimal for flat ellipses.  This value of D translates into the following formula attributed to the Japanese mathematician Takakazu Seki Kowa (1642-1708)  [Stephen Vadakkan (1952-) bizarrely touted it as exact in 1998].  This formula features a nonnegative relative error that is zero at either extreme (ellipse of eccentricity 0 or 1-) and reaches a maximum of about +1.354215531617% for an eccentricity near 0.9836148.

(  )
P »  2 Ö p2 ab + 4 (a-b)2     =   p (a+b) Ö 1 + h (16/p2 - 1)

D may also be optimized according to various other criteria.  In particular, the value of D which yields the lowest maximal relative error over the entire range of eccentricities is slightly less than 2.458338:  This value of D yields a maximum relative error of magnitude roughly equal to 0.8647955 %, either when e is around 0.9736479 (positive error) or when e is 1- (negative error).

For some obscure reason, the value D = 2.2  became popular...  It was probably someone's educated guess at some point...  Virtually everyone seems to have bypassed the relevant numerical analysis.  Such an expression (with D = 2.2) appears in the venerable Machinery's Handbook by Industrial Press, Inc.

  • p. 64 of the 25th edition © 1996, or
  • p. 65 of the 26th edition © 2000, or
  • p. 68 of the 27th edition © 2004.

The Machinery's Handbook merely touts it as a "closer approximation" than the following formula (corresponding to D = ¥) first given by Euler in 1773:

(7)
P  »  p Ö2(a2+b2)

If it was not for the fact that Euler expanded this approximation into an exact expression, the popularity of Euler's formula would be rather surprising, since it's not much better than the following naive formula, which happens to belong to the same family (it corresponds to  D = 1). This simplest of all formulas also corresponds to  p = 1  in the Hölder parametrization discussed below  (where the formulas of Kepler and Euler correspond respectively to  p = 0  and p = 2):

(8)

P  »  p ( a + b )

For a nearly round ellipse, the precision of this formula is virtually the same as Euler's except that the error is negative instead of positive. For elongated ellipses, Euler's formula is pretty bad (+11%) and this one is only twice as bad (-21.5%).

In 2001, David W. Cantrell proposed another type of formula, which may be optimized like our quadratic formula (6), but with numerical results that turn out to be more than 50 times better!  (See 2001-01-25, 2001-05-08, etc.)
Cantrell's formula is expressed in terms of the Hölder mean of the principal radii, namely Hp = [(ap+bp)/2]1/p  , where the value of the exponent p is discussed below (the two forms of the formula are equivalent because   HpH-p = ab ):

(9)

P   »   4(a+b) - 2(4-p) ab / Hp   =   4(a+b) - 2(4-p) H-p

Unlike the YNOT formula (5), which is accurate for circles with only one choice of exponent, Cantrell's formula (9) is accurate for both flat ellipses (b=0) and circles (a = b = H),  for any exponent p>0.  The value of p may thus be optimized for different criteria.  For low eccentricities, the relative error of Cantrell's formula is:

e4[1+e] [p(8-2p)-(3p-8)] / 64p +
e8 [8p(167-3p-2p2)(4-p) - 2007p + 5376] / 49152p + O(e10 )

The value p = (3p-8)/(8-2p), which is about 0.829896183, is thus optimal for round ellipses (low eccentricity e).  With this value of p, the worst relative error is about 0.0223355421282955 %, (it is obtained for an ellipse of eccentricity slightly below 0.99742841112, eccentricity 0.9974284... corresponding to an aspect ratio b/a around 7.167 %, as pictured at left).

Cantrell observes that an exponent p of about 0.825056176207... yields a worst relative error of less than 83 ppm (0.00008296523...) which is reached for an eccentricity either around 0.9475017 (negative error)  or 0.9992308 (positive error) whereas the formula is correct when e is  0, 1-, or 0.9913373351338...  In practice, an exponent p = 0.825 (or 33/40) may be used, which yields an error of less than 85 ppm for any ellipse...  Yet another value of p is optimal for very elongated ellipses, namely ln(2)/ln(2/[4-p]) or about 0.819493675...

We summarize the precisions of many of these approximations in the table below, where the first entry is the simple formula given by Johannes Kepler in 1609 as a lower bound to the perimeter of an ellipse, (according to Almkvist and Berndt):

(10)
vinculum
P » 2p Öab

It's worth noting that this formula is a special case of the quadratic formula (6)  with D = ½.  It is also the limit of  2pHp  when p tends to zero  (the geometric mean is sometimes said to be the zero-exponent Hölder mean).  The Kepler formula (10) thus belongs to a family which includes the Euler formula (7) for p=2, the naive formula (8) for p=1, and the YNOT formula (5) which corresponds to p = y = 1.53492853566... It is thus fairly natural to include in our table the one formula of this family (proposed by Muir in 1883) corresponding to the value of p which is optimal for low eccentricities, namely p = 3/2 = 1.5 :

(11)

P » 2p [(ap+bp)/2]1/p       with p = 3/2

Near e = 0, the relative error is about  (2p-3) e4/64 [1 + e]  for other formulas of this family, but it's much lower for Muir's formula itself, as shown in the table below...  The original motivation of the paper by Barnard, Pearce and Shovanec was to prove that Muir's formula is indeed a lower bound for the circumference of any ellipse (a question apparently first raised by Matti Vuorinen in 1996).

The first 8 tabulated entries belong either to the quadratic family of formulae or to the 2pHp Hölder family, and the first 3 of these formulae belong to both.
Perimeter
Formula
Relative Error D for Earth
Meridian (m)
Worst (%)Low Eccentricity e
10
a
Kepler 1609
-100 -3e4/64 [1+e+...] -84.61 m
(8)
a
p ( a + b )
  -21.46 -e4/64 [1+e+...] -28.20 m
(7)
b
Euler 1773
  +11.072 e4/64 [1+e+...] +28.20 m
(6)
bc
Seki  c.1680
    +1.3542 ( 32/p2-3) e4/64 [1+e+...]   +6.83 m
D = 2.458338     ±0.8648 (1-2/D) e4/64 [1+e+...]   +5.26 m
(5)
bc
Maertens 2000
    +0.3619 (2y-3)e4/64 [1+e+...]   +1.97 m
(1)
a
D = 2
    -3.809 -3e8/214 [1+2e+...]   -1.49 10-5
11
a
Muir 1883
    -1.046 -e8/214 [1+2e+...]   -4.97 10-6
(9)
bc
Cantrell 2001
    +0.0223 [80-16p-3p2]e8/[49152(4-p)2]   +2.83 10-7
(  )
a
Lindner 1904
    -0.598 -e12/220 [1+3e+...]   -3.50 10-12
(2)
a
Ramanujan I
    -0.416 -e12/221 [1+3e+...]   -1.75 10-12
(4)
a
Hudson 1917
    -0.189 -9e16/230 [1+4e+...]   -1.39 10-18
(  )
a
Jacobsen 1985
    -0.0888 -33e20/238 [1+5e+...]   -8.97 10-25
(3)
a
Ramanujan II
    -0.0402 -3e20/237 [1+5e+...]   -1.63 10-25
Notes:   [ a = lower bound formula ]   [ b = upper bound formula ]   [ c = correct for flat ellipses ]

It should be noted that all the formulas tabulated above could be cast in the form p(a+b) f(h) , where f(h) can be expanded as a power series of the previously defined quantity h = (a-b)2/(a+b)2 = l2. The same remark applies to the exact expression of the circumference (see below for the explicit expression of the perimeter involving such a power series of h ). For those formulas where this remark may not be so obvious (for example, 2pHp and/or the Cantrell formula), you may prove it by assuming [without loss of generality] that a+b=1 so that a=(1+l)/2 and b=(1-l)/2, where l is the square root of h. Expanding as a power series of l any formula where a and b can be formally interchanged may thus only involve even powers of l (since interchanging a and b means changing the sign of l). In other words, what we are left with is indeed a power series of h=l2. One consequence of this remark is that the relative error for low eccentricities is also a power series of h, whose leading term is proportional to some hn.  Since h happens to be equal to e4(1+e2)/16 + O(e8), this means the two leading terms in the relative error expressed as a power series of e are proportional to e4n(1+ne2) for some integer n, as may be observed from the table.

This remark about symmetry only applies to analytical expressions [expressible as power series about  a = b].  A term like |a-b| is not analytical and disqualifies something like the following "symmetrical" way of expressing the only linear approximation for the perimeter of an ellipse which is exact for both a circle and a flat ellipse  (an unused poor approximation which is otherwise best discarded):

P   »   p (a+b) + (4-p) |a-b|       [ this is   4a + (2p-4)b   when a > b ]

Very Precise Computations
of the Circumference of any Ellipse

The exact series we first gave does converge even for e=1, but the convergence is quite slow in that case: The partial sums (giving P for e=1 and a=1) start with 2p or about 6.283 for n=0, then 4.7124 for n=1, 4.18575 for n=5, 4.096344 for n=10, 4.01985 for n=50, 4.00996 for n=100, etc. The asymptotic expression for the partial sum (up to and including the term of rank n) turns out to be:

4 +1/n -3/8n2 +3/32n3 +3/512n4 -33/211n5 -39/214n6 +699/216n7 +4323/221n8 -120453/223n9 ...

With a relative error roughly equal to 1/4n, the convergence is thus so poor that the series is not usable "as is" for very precise numerical computations about very elongated ellipses.

 Exact

A similar remark applies to another exact expression of the ellipse's perimeter, in terms of  h = (a-b)2/(a+b)2, using what's now called the Gauss-Kummer Series of h, where the coefficient of h n is the square of the fractional binomial coefficient C(1/2,n) = (1/2)(1/2-1)(1/2-2)...(1/2-n+1)/n! :

= p (a+b) [ 1 + h/4 + h2/64 + h3/256 + 25h4/16384 + 49h5/65536 + ... ]
 
= p (a+b)   
 
¥
å
n = 0
 ì½
 î n
ü2
þ 
 
hn                where    
 
 ì½
 î n
ü 
þ 
 
 =  
 
 ì2n
 î n
ü 
þ 
1
Vinculum
(1-2n)(-4)n

Note that the coefficient of hn is   1/(1-2n)   times the coefficient of e2n in the above Maclaurin series, where we had factored out 2pa instead of p(a+b).

The Gauss-Kummer series has better convergence properties than Maclaurin's series over the whole range of eccentricities, but the relative error for flat ellipses (» 1/32n) still leaves a lot to be desired:  For the record, the partial sum whose last term is of rank n has the following asymptotic expression for flat ellipses:

4 -1/8n2 -3/16n3 -97/512n4 -75/512n5 -1433/214n6 -1449/215n7 -66277/221n8 -33375/220n9 - ...

Other tools are therefore clearly needed to study the behavior of P(e) about e=1. One approach is to approximate a very elongated ellipse near its vertex by its osculating parabola [think of the orbit of a long-period comet near its perihelion] in order to derive a formula like:

P(e)/a = 4 - (1-e2) ln(1-e2) + O(1-e2)

 Exact

This is the beginning of an exact expansion in terms of   x = 1-e2 = b2/a2 [due to Arthur Cayley (1876) according to D.W. Cantrell].  In Cayley's series, the coefficient of xn is  n(2n-1)C(½,n)2 times some square bracket:

P/4a  1   +   (x/4) [ln(16/x)-1]   +   (3x/32) [ln(16/x)-13/6]   +
(15x/256) [ln(16/x)-12/5] + (175x/4096) [ln(16/x)-1051/420] + ... +
xn   13 ... (2n-3)(2n-1) [ ln(16/x)    4     4     4     2   ]  + ...
vinculum vinculum minus vinculum minus vinculum ellipsis vinculum minus vinculum
2 24 ... (2n-2) 2n 1´2 3´4 (2n-3)(2n-2) (2n-1)2n

The above square brackets are all positive.  In fact, their greatest lower bound is simply the positive quantity  ln(1/x).  [ Since  1/(2k-1)2k   is   1/(2k-1) - 1/2k,  the sums involved are partial sums of the Taylor series of  4 ln(1+z)   with z = 1.]

When a very precise value of the circumference of an ellipse is needed at a reasonable computational cost over the whole range of eccentricities (including both extremes), a very good idea is therefore to use the above expansion if the ellipse is somewhat elongated and the Gauss-Kummer expansion otherwise...   Eccentricity = 96% 
 Ratio b/a = 28% In thrifty implementations, a Gauss-Kummer term is roughly twice as fast to compute (3 additions, 3 multiplications, 1 division) as a term in Cayley's series (6 additions, 5 multiplications, 2 divisions).  This makes it most efficient to switch from one method to the other at an eccentricity of about 96%,  which may be considered an arbitrary boundary between round and elongated ellipses (corresponding to an aspect ratio b/a of exactly 28 %, as pictured above).

Below is an optimized way to compute the perimeter of any ellipse in QBASIC, which makes full use of whatever precision is available, through a generic test used in each "while" summation loop... Each loop computes only a  correction  to a main term that's added aftwerwards in order to drown the rounding errors which occurred in the successive additions.  The only downside is that sums may be carried out slightly beyond what's necessary...  In the worst case, this simple trick provides about one extra digit of accuracy here, which is more than enough to drown random rounding errors in the summation of about three dozen terms required (in the worst case) to reach QBASIC's "double-precision" accuracy.  The trick is thus about as good as the recommended general procedure of adding first the least elements in a sum of many positive terms...  [ Fixed-precision floating-point addition is a commutative operation which is not associative ! ]

DECLARE FUNCTION gk# (h#)
DECLARE FUNCTION cayley# (x#)
DEFDBL A-Z
CONST pi = 3.141592653589793#

Perimeter of an Ellipse
in QBASIC
© 2002, Gérard P. Michon

INPUT "a,b="; a, b
a=ABS(a): b=ABS(b)
IF a < b THEN x=a: a=b: b=x
IF b < 0.28*a THEN
 P = 4*a*cayley((b/a)^2)
ELSE
 h = ((a-b)/(a+b))^2
 P = pi*(a+b)*gk(h)
ENDIF
PRINT "Ellipse Perimeter ="; P
END

DEFDBL A-Z
FUNCTION gk (h)
z = 0: x = 1: n = 0
REM Add 1 (to z) afterwards...
 WHILE z + x <> z
 n = n + 1
 x = h * x * ((n-1.5)/n)^2
 z = z + x
 WEND
gk = 1 + z
END FUNCTION
 
DEFDBL A-Z
FUNCTION cayley (x)
y = LOG(16# / x) - 1
t = x / 4
n = 1
z = 0: REM Add 1 afterwards.
u = t * y
v = (n - .5) / n
w = .5 / ((n - .5) * n)
 WHILE z <> z + u
 z = z + u
 n = n + 1
 t = x * t * v
 v = (n - .5) / n
 t = t * v
 y = y - w
 w = .5 / ((n - .5) * n)
 y = y - w
 u = t * y
 WEND
cayley = 1 + z
END FUNCTION
REM Multiplications minimized
The orbit of Halley's comet (pictured below) is an ellipse with an eccentricity of about 0.9673.  Its shape is thus only slightly more elongated than the above threshold.   Orbit of
 Halley's comet. This is a far cry from the "extremely elongated" ellipse described in many popular accounts about the Comet (whose authors may have been impressed by a number "so close" to unity).  Unlike the aspect ratio (b/a = 25% in the case of Halley's comet), the eccentricity e is a misunderstood measure of the elongation of an ellipse.  This is why we felt compelled to sprinkle this page with small graphics indicating what the ellipses of various eccentricities actually look like...

 Exact Keywords for further research are "elliptic integrals" (which are to an ellipse what inverse trigonometric functions are to a circle) and "elliptic functions" (the elliptic equivalents of trigonometric functions). Two different definitions of the function E (the so-called complete elliptic integral of the second kind) have been given, which correspond to two different exact expressions for the perimeter of an ellipse: Either P = 4a E(e) or P = 4a E(e). Either version of the function E(z) can be studied about z=0 or about z=1. In the literature, the above is discussed in terms of the function E.  In particular, the 3 exact expansions we gave appear [with different notations] in section 8.114 of Gradshteyn & Ryzhik  (6th edition p.853, or 4th edition pp.905-906).


References

  1. G. Almkvist and B. Berndt ( MR89j:01028 )
    "Gauss, Landen, Ramanujan, the Arithmetic-Geometric Mean, Ellipses, p, and the Ladies' Diary"
    The American Mathematical Monthly,  v.95 (1988, #7) 585-608.
  2. Roger W. Barnard, Kent Pearce, Kendall C. Richards.
    "A Monotonicity Property Involving 3F2 and Comparisons of the Classical Approximations of Elliptical Arc Length"
    2000 SIAM J. Math. Anal. Vol. 32, No. 2,  pp. 403-419.
  3. Roger W. Barnard, Kent Pearce, Lawrence Schovanec
    "Inequalities for the Perimeter of an Ellipse"
    Online preprint  (Mathematics and Statistics, Texas Tech University)
  4. I.N. Bronshtein, K.A. Semendyayev
    "Handbook of Mathematics" translated from Russian and German
    1985 3rd English Edition,  Van Nostrand Reinhold Co., New York.
  5. I.S. Gradshteyn, I.M. Ryzhik
    "Table of Integrals, Series, and Products" translated from Russian
    Edited by Alan Jeffrey and Daniel Zwillinger. Errata updated online (pdf).
    6th edition ©2000 Academic Press,  ISBN 0-12-294757-6 Elliptic Functions 
by Arthur Cayley
  6. E.H. Lockwood   "Length of Ellipse"
    Note 1045   [pp. 269-270]
    Mathematical Gazette   Vol. 16 (1932).
  7. Arthur Cayley (1821-1895)
    "An Elementary Treatise on Elliptic Functions"  (1876)  Art. 78
    Second edition (1895) reprinted by Dover Books in 1961.  [pp. 52-55]
 

Perimeter of an Ellipse Revisited...
Footnotes

The above presentation of approximative and exact expressions for the perimeter of an ellipse cannot be entirely exhaustive.  Several readers have brought to our attention a number of significant omissions and/or new developments.  At first, we were working these into the main discussion, but this got out of hand...  Instead, we are now listing below whatever new contributions could be skipped on a first reading.  We've also moved parts of our original discussion here, in order to streamline it.
 
Most of the items below may thus be considered footnotes to the main presentation...

(2001-01-25)   Formulas involving Padé approximants
This family of formulas used to be part of our main discussion...

A Padé approximant is the ratio of two polynomials (of degrees p and q) whose Taylor expansion matches the Taylor expansion of the target function  f  up to order  p + qHudson's formula and Jacobsen's formula are both obtained using Padé approximants of the Gauss-Kummer power series of h.

Further improvements using the same approach are less simple:  At the next level, we obtain the following expression, which is much more accurate than Ramanujan's second formula for a round ellipse but it's not nearly as simple.  It's almost as good for a flat ellipse  [with a relative error of about -0.046 %].

(  )
 
P » p (a+b)  
 
3072 - 1280 h - 252 h2 + 33 h3
Vinculum
3072 - 2048 h + 212 h2

The next formula along the same road features a ratio of two cubic polynomials. It's certainly not an easy-to-remember expression, but it's much more accurate than any of the above for round ellipses, as it boasts a relative error of about -(14627/33) e28 /254, translating into a laughable accuracy for the Meridian roughly 45 times smaller than the Planck Length. However, the relative error of this formula for the perimeter of a flat ellipse is still no better than -0.0267 % :

(  )
 
P » p (a+b)  
 
135168 - 85760 h - 5568 h2 + 3867 h3
Vinculum
135168 - 119552 h + 22208 h2 - 345 h3

Such formulas are probably best obtained using a device which is to analytic functions what truncated continued fractions are to real numbers. The above ratio is equal to the following expression, truncated "at order m=6", where the coefficients to use are:  a0 = 1, a1 = 4, a2 = -4, a3 = 4/3, a4 = -4, a5 = 12/11, a6 = -484/115. [The sequence would go on with a7 = 158700/160897, etc.]

 a0 +  h
Vinculum
 a1 h
Vinculum
 a2 h
Vinculum
 a3 h
Vinculum
 a4 h
Vinculum
a5 h
Vinculum
a6

Truncating at m=3 gives Hudson's formula, while Jacobsen's formula corresponds to m=4.  Truncation at m=2 yields a -0.516233% error for a flat ellipse, with the simpler of two circumference formulae given in 1975 by Ernst S. Selmer (1920-):

(  )
 
P » p (a+b)  [ 1  +  
 
4 (a-b) 2  
 ]     =   p (a+b)  
 
16 + 3 h
Vinculum Vinculum
(5a+3b)(3a+5b) 16 - h

The proper sequence of coefficients [1, 4, -4, 4/3, -4, 12/11...] is not too difficult to obtain:  Consider a function f(h) which is to be approximated in this way [if we only want the above coefficients up to am, we may replace an analytic function f(h) by its partial Taylor expansion up to --and including-- the term or order hm]. The Taylor expansion of  f will then match that of the above rational expression up to --and including-- the order m of the last coefficient used, if an = fn(0), where fn is recursively defined via:  f0(h) = f(h) and  fn+1(h) = h / [ fn(h) - an ].

In general, a relation of the type fn+1(h) = hk / [fn(h)- an ] should be used with whatever value of k leads to a nonzero finite value of an+1 (this usually means k=1). These successive values of k would appear as exponents of h in the final rational expression (in particular, if f is an even function of h, then h2 would normally appear at each stage of the rational approximation). Things may thus be slightly more complicated than with the case discussed here.

In the above, an odd order of truncation (m) gives a rational approximation where the degree of the numerator is one unit higher than the degree of the denominator. If we apply the method to 1/f(h) instead [and take the reciprocal of the result] we obtain a numerator of lower degree than the denominator. (At even orders of truncation, the results of the two approaches coincide.) For this "reciprocal" approach, the sequence of coefficients is: 1, -4, -4/3, -12, 4/21, -588/11, 484/9023, -19938252/160897, 855796516/33965156445, etc. With truncation at order m=3 [which gave Hudson's formula in the direct approach] we obtain the following expression, which turns out to be slightly inferior to Hudson's formula. Its relative error for the circumference of a round ellipse is about -21 e16/230 [this is 7/3 » 2.3 times worse than Hudson's formula] and roughly -0.267 % for a flat ellipse [1.4 times worse than Hudson's expression].

(  )
 
P » p (a+b)  
 
64 + 16 h
Vinculum
64 - h2

David W. Cantrell   (2004-05-24)
Improving Ramanujan's second formula [over the entire range of h].

Like most historical approximations to the perimeter of an ellipse, the second formula of Ramanujan reaches its worst relative error for a degenerate ellipse:  Its O(h) relative error reaches a maximum of (7p/22-1) for a flat ellipse  (h = 1).

Therefore, the following formula is exact for a flat ellipse while retaining the same leading error term for a roundish ellipse as Ramanujan's second formula, provided  f  is O(1) and equal to 1 for a flat ellipse  (h = 1):

(  )
P » p (a+b) [ 1 + 3h / ( 10+Ö4-3h  )  +  4 h6 (1/p - 7/22)  f  ]

David W. Cantrell  has proposed the O(h12 )  correction  f = h, for a relative error never worse than ±15 ppm.  This proposal was spurred by a more complex correction term presented to him by Edgar Erives.  The exponent 6 is merely the integer closest to an optimal exponent which is only minutely better.


Ricardo Bartolomeu (2004-06-06; e-mail)   Beginner's Luck...

On 2004-06-06, Ricardo Bartolomeu asked us to evaluate a  [very messy] trigonometric approximation of the perimeter of an ellipse, which he had stumbled upon, with apparently good results.  Miraculously, Bartolomeu's expression happens to be equivalent to a nice symmetric function of a and b:

P   »   p (a-b)  /  arctg [ (a-b) / (a+b) ]   =   p (a+b) [ 1 + h/3 + O(h2 ) ]

This simple formula is defined by continuity for a = b.  It's exact for a circle and a flat ellipse and is about 5 times less accurate than the YNOT formula  (both for low eccentricities and over the entire range, with a worst relative error exceeding 1.72 % for an ellipse of eccentricity near 0.983).  This goes to show that even wild guesses can be fairly accurate if they turn out to be symmetrical.

In 1932, E.H. Lockwood had proposed a similar approximation of the perimeter of an ellipse, which has a worst relative error of almost -0.9% (when e»0.9598).  It's about four times less accurate than the YNOT formula for a round ellipse:

»  (4b2/a) arctg (a/b) + (4a2/b) arctg (b/a)  =  p (a+b) [1 + (4-12/p)h + ...]

Another attempt...

On 2004-08-02, Ricardo Bartolomeu asked us again to evaluate yet another [slightly less messy] trigonometric approximation for the perimeter of an ellipse, which could be reduced to the following asymmetrical formula:

P   »   p Ö2(a2+b2)   sin(x) / x         where   x  =  (1-b/a) p/4

Again, this is defined by continuity for  a = b  (sin(x)/x tends to 1 as x tends to 0) and the formula is exact for a circle, a flat ellipse, or an ellipse of eccentricity:

0.88729428292031793745442629632208285906244622844440758655...

Below that, the relative error is negative but never worse than -0.184 %  (for eccentricities around 0.766764) above that, it's positive but never worse than +0.9822 % (almost reached for an ellipse of eccentricity around 0.991233).

For the perimeter of an ellipse of low eccentricity e,  the relative error is:

-e4 (p2-6) / 384   +   e6 (12-p2 ) / 768   +   O(e8)

That's more than 9.23 times worse than the commensurable YNOT formula...


David F. Rivera (2004-02-24; e-mail)   Rivera's Formula

David Rivera (of the Naval Undersea Warfare Center, RI) has contacted us to share the approximative formula for the circumference of an ellipse which he developed around 1997 and has used in his antenna work:

 
P   »   4  
 
æ 
è
p ab + (a-b) 2 ö 
ø
         89    æ 
è
aÖb - bÖa ö 2
ø
Vinculum minus sign Vinculum Vinculum
a + b   146 a + b

This formula clearly gives the correct circumference for a circle (a = b) and a flat ellipse (b = 0).  It is also exact for an ellipse of eccentricity

e = 0.986118932960305275314772672749686388...

For a rounder ellipse, Rivera's formula features a negative error which is never worse than -103.70 ppm (when e is around 0.9329538).  For a flater ellipse, the error is positive, but never worse than +103.73 ppm (for e around 0.99811).  All told, the relative error of Rivera's 1997 formula is always better than 104 ppm and is thus almost as good as Cantrell's 2001 formula.  (104 ppm vs. 83 ppm)

The value  p = 89/146   is a good rational approximation to the value which minimizes the magnitude of the worst relative error(s) in a parametrized formula which, incidentally, could be rewritten as follows, for any value of p :

P   »   p (a+b) [ 1 + (4/p-1) h - (p/4p) {1 - h - (1-h) 3/2 } ]

For any p, the parametrized Rivera formula is exact in the case of a circle (h=0) or a flat ellipse (h=1).  The optimal value of  p  for low eccentricities is 32-10p.


David F. Rivera had submitted another approximation to the perimeter of an ellipse among errata to the 30th edition of the Standard Mathematical Tables and Formulae (CRC Press)...  This formula is the only one of its kind given in the 31st edition.  [ Thanks to David Cantrell for pointing this out. ]

P   »   2a [ 2 + (p - 2) (b/a) 1.456 ]

This asymmetrical expression is exact for a circle or a flat ellipse.  The relative error is also zero for an ellipse of eccentricity around 0.921271.  Below that point, it's negative but never worse than -0.447 % (around 0.7129); above that point, it's positive but never worse than +0.439 % (around 0.9883). 


David W. Cantrell   (2004-05-23)   Cantrell's 2004 Ellipse Formula

Cantrell considers approximations to the perimeter of the ellipse of the form:

P   »   4(a+b) - 2(4-p) ab / f

In his original 2001 proposal, Cantrell had used  f = [ ½ (ap+bp) ] 1/p, namely the Hölder mean of the principal radii  ( p = 33/40  yields an 85 ppm accuracy).

Seeking better accuracy and computational simplicity, Cantrell now introduces a two-parameter expression for  f   (the more parameters to optimize, the better) which makes  f  equal to a when a = b, for any choice (within limits) of p and k :

Vinculum
 f   =     p (a + b)   +   [ (1-2p) / (k+1) ] Ö(a + kb)(ka + b)

For an ellipse of low eccentricity, the formula yields an optimal O(h3) error when:

  • (k-1)2 / (k+1)2   =   p(60-19p)  /  [4 (4-p) (16-5p) ]
  • p   =   (380p-69p2-512)  /  [ 2 p (60-19p) ]

Numerically, that's approximatively  k = 133   and   p = 0.412.  However, Cantrell's primary concern is to minimize the  worst  relative error.  For this, he settles on k = 74 and uses an approximation of the corresponding optimal value of p  (0.410117...)  to claim an overall accuracy of 4.2 ppm.


Lu Chee Ket (Malaysia.  2004-06-23 e-mail, and 2004-06-25)
C.K. Lu's rediscovery (2003) of an expansion due to Euler (1773).

In 1773, Leonhard Euler (1707-1783) gave an exact expansion for the perimeter of an ellipse which may be expressed as a power series of the quantity d defined below.  By itself, the first term of this expansion gives Euler's crude approximation, which has already been discussed above...

P  =  p Ö2(a2+b2)
    [ 1 - 2-4 d - 15´2-10 d2 - 105´2-16 d3 - ... ]
=  p Ö2(a2+b2)
    ån  (d/16)n  (4n-3)!! / (n!)2

where d   =   [ (a2 - b2 ) / (a2 + b2 ) ] 2   =   4h / (1+h)2

 Exact This formula for the perimeter of an ellipse converges slightly faster than Maclaurin's asymmetrical expansion in terms of powers of e  [with the major radius factored out] but it's much worse than the symmetrical Gauss-Kummer expression  [with the sum of the radii factored out].

For a flat ellipse, expanding up to d n yields a relative error of  1/16n+O(1/n2).
(Another approach is thus recommended for a flat ellipse.)


(2004-07-06)   Exact Expansions for the Perimeter of an Ellipse :

Some of the above exact formulas for the circumference of an ellipse may be expressed using Gauss's (1812) hypergeometric function F  (also denoted 2F).

 Exact
AuthorDatePerimeter of the Ellipse
Colin Maclaurin1742 2pa  F(½, -½; 1; e2 )
Leonhard Euler1773
p Ö2(a2+b2)   F(¼, -¼; 1; d)
James Ivory (*)1796 p(a+b)  F(-½, -½; 1; h)
Arthur Cayley1876   Best for high eccentricities.  

(*)  In fact, the Gauss-Kummer series first appeared in the earliest memoir ever published by the Scottish mathematician Sir James Ivory (1765-1842; knighted in 1831):  A New Series for the Rectification of the Ellipse, Transactions of the Royal Society of Edinburgh, volume 4, part II, pp.177-190 (1796).

visits since July 18, 2001
 (c) Copyright 2000-2005, Gerard P. Michon, Ph.D.