# Perimeter of an ellipse

An ellipse is described by two parameters, *a* and *b*, that generalize the role of the radius *r* of a circle. The equation of an ellipse is

where by convention *a* ≥ *b*. The parameter *a* is called the semimajor axis, equal to half of the widest distance across the ellipse. The parameter *b* is the semiminor axis, equal to half the narrowest distance across the ellipse.

If *a* = *b* then the ellipse is a circle and its perimeter is the circumference of the circle π*r*. If *a* ≠ *b* then there is no equation for the perimeter in terms of elementary functions. There is an advanced function that gives the **exact perimeter** of an ellipse, which we will get to shortly. But first we give **approximations** for the perimeter in terms of elementary functions.

## Simplest approximation

A simple approximation, one that is accurate when *a* isn’t too much larger than *b*, is given by

For more on this approximation, including details on its accuracy, see here.

## Better approximation

Ernst Kummer found a series that converges quickly to the perimeter of an ellipse. The first four terms of the series would be adequate for most practical purposes.

First define

Then Kummer’s series is

If you don't need much accuracy, or if *a* ≈ *b*, then you will not need four terms of the series.

More on Kummer’s series here.

## Exact perimeter

The perimeter of an ellipse is given exactly by a function called “the complete elliptic integral of the second kind” denoted *E*.

Unfortunately there are two conventions for defining *E*, one in terms of the “elliptic modulus” *k* and one in terms of the “parameter” *m* [1]. The relation between the two is *m* = *k*².

Let *e* be the eccentricity of an ellipse.

Then the perimeter of an ellipse is given by

when *E* is parameterized by the parameter *m*.

Python and Mathematica both use the “parameter” convention, and so you can calculate the perimeter of an ellipse in Python by using

4*a*scipy.special.ellipe(1 - b**2/a**2)

or in Mathematica using

4 a EllipticE[1 - b^2/a^2]

but you may see the perimeter given as 4*aE*(*e*) in sources that are using the elliptic modulus convention. If you are unsure what convention your software is using, you might check whether one of the approximations above gives similar results. Note that you cannot use a circle as your test case because then *e* = 0 = *e*².

[1] To make matters worse, *m* **does not** stand for *modulus* as you might reasonably expect; *m* stands for *para meter*.

## Length of an elliptic arc

If you want to find the perimeter of *part* of an ellipse, see here.

These notes are brought to you by