Dave Martin
# Mathcad Community Challenge March 2024: Perimeter of an Ellipse

- 4/16/2024
- Read Time : 4 min.

The Mathcad Community Challenge for March 2024 was based on the geometrical problem below:

I am shocked that I have walked the surface of this planet for over five decades without realizing that there is no exact closed-form solution for the perimeter of an ellipse. In school, we learn the perimeter of shapes like triangles, squares, rectangles, circles, parallelograms, and so on, but I feel like schools and teachers conveniently skipped over ellipses. (An ellipse, in case it’s been a while, is the set of points where the sum of the distances from two points—the foci—is a constant.)

The challenge is to correct that oversight. Create a Mathcad Prime worksheet that:

- Derives, depicts, or shows one (or more) of the various approximation formulas/methods for the perimeter of an ellipse
- Create a calculator whereby someone can change the values of the semi-major and semi-minor axis lengths in order to find the perimeter.
- Create a 3D plot of the perimeter as a function of the ellipse semi-major and semi-minor axis lengths.

Although there is no exact solution for the perimeter of an ellipse, this is a fairly well-documented problem. Therefore, documentation in the worksheet is key. This worksheet should be able to stand on its own and be understood by someone with a basic knowledge of calculus (since integrals and infinite series are involved).

If you are interested in learning more about calculating the perimeter of an ellipse, there are websites like Math is Fun, Cue Math, and Numericana. Broadly speaking, the solutions fall into the following categories:

- Approximation formulas
- Formulas involving infinite series
- Formulas that use integration

Let’s dive into the worksheets provided by our intrepid math explorers.

This month’s challenge generated quite a healthy discussion, with over 30 forum replies. In accordance with the rules and guidelines, only Mathcad Prime and Mathcad Express submissions will be discussed here. There are ten worksheets we will discuss.

Frequent contributor **Terry Hendicott** was the first to respond. He provided a concise, elegant-looking, single-page worksheet that is easy to understand. After setting up variables and function definitions, he used a range variable to display the ellipse on an XY plot. He used a definite integral formula that calculated the perimeter accurate to ten significant digits.

Not satisfied with that, Terry contributed feedback on the work of others and submitted a worksheet with a second approach. There’s quite a bit of matrix work involving trigonometry functions, but he managed to plot perimeter as a function of the two semi-axis values on an XY plot. In other words, he managed a 3D plot on a 2D plot. Ingenious.

**Valery Ochkov** provided a couple worksheets that I would normally fault for lack of documentation, but I assume English isn’t his first language since he resides in Russia. He used symbolic evaluation to solve the equation for an ellipse in terms of y, and then used symbolic evaluation to find the derivative of that solution. He then used a function that incorporated that solution in a definite integral. He graphed that function on a 3D plot, making use of the Try…On Error programming construct.

I can always rely on **Alan Stevens** to submit a well-documented worksheet that could appear as a chapter in a math textbook or a teaching aid in a college class. Rather than use one of the existing publicly available formulas, Alan derived his own. His method involved expansion and integrals based on the derivative of the ellipse function, and the logic is well explained. Alan even wrote and plotted a formula to calculate the error in the perimeter based on the ratio of the semi-major to semi-minor axes.

User **DJF** formulated an approach based on the method Archimedes used to calculate the circumference of a circle and the circle constant *pi*. Another original approach. He wrote a program for the vector of x-coordinates of the ellipse subdivided into a thousand segments, vectorized the value of the y-coordinates, and calculated the length. He increased the number of subdivided segments progressively up to nine million to show how the solution converged on a result.

**Bert Beirinckx** did two special things in his worksheet. He was the first to solve for the perimeter using polar coordinates instead of more traditional Cartesian coordinates. (The ellipse is also graphed on a Polar plot.) Second, Bert plotted the perimeter as a function of the semi-major and semi-minor axes on a Contour plot. This might be the first time I’ve seen a Contour plot in a Mathcad challenge.

Frequent contributor **PPal** calculated the perimeter in a brief worksheet using Ramanujan approximations. However, as PPal notes in a quote in a text box, Ramanujan never explained how he came to this approximation. Fascinating, given how often his name comes up in discussions about ellipses.

The final Mathcad Prime submission was from **Fred Kohlhepp**, another frequent contributor. Like Bert, Fred solved using polar coordinates. Knowing the distance of any point from the center in terms of the angular coordinate, he integrated over the extent of the polar coordinate. However, Fred got an incorrect result. This is where community comes in. Fred posted about the error, and Alan Stevens provided insight into the correct solution.

This month’s challenge once again exemplifies a common theme we’ve seen from previous months. Mathcad users have a variety of techniques and tools to solve the same problem. For calculating the perimeter of the ellipse, we had approximation formulas, Ramanujan approximations, infinite series, and integrals. People used variables, functions, derivatives, matrices, symbolic evaluation, programs, and polar coordinates. Solutions were graphed with XY plots, Polar plots, Contour plots, and 3D plots. The math was supplemented with documentation including text, images, headers, footers, and hyperlinks.

To spark your creativity and approach your next problem with a fresh outlook, browse through this month’s submissions. And join us in May for the next challenge!

Hear about each new Mathcad challenge and other exciting updates by subscribing to our monthly newsletter.