You are using the new UI (Beta).Return to the original UI

This page has been automatically translated by machine translation. Please note that translations may not be entirely accurate.

keisanHigh-precision calculations for everyday life and work

Circumference of an Ellipse

Author: yangmaskExecutions: 430505

※ This library was created by a member. This site is not responsible for its content.

Manage Bookmarks
This is a program that calculates the circumference of an ellipse.

The basic idea is to divide the radius into 1,000 equally spaced segments, identify the points where the horizontal lines at those segments are tangent to the ellipse,
and then calculate the total length of the lines connecting those points...
In short, it uses a polygon to obtain an approximate value for the circumference of the ellipse.

For more details, please refer to the link below.
In terms of precision, please note that when the semi-major axis is 1, the calculation results are accurate to 0.00001.
Short radius
Long radius
 
For example, try calculating it as a perfect circle with a major radius of 0.5 and a minor radius of 0.5—that is, a diameter of 1. If you do that, the result should be 3.14158335634999245734. In other words, it is pi.Since the true value of pi is said to be 3.1415926535..., we can see that the precision (when the major radius is 1) is to the 0.0001 place.

The reason I divided it into 1,000 segments is that there were issues—such as the calculation timing out—when trying to go beyond that. If you perform the calculation on your own computer, you might be able to obtain a value with even higher precision.

_____

The program is shown below. Please modify the `precision = 0.001` part to a smaller value, and adjust the `n <= 1000` in the second line so that `n` equals 1 divided by the precision value.

k = 0; precision = 0.001; aspect_ratio = short_radius / long_radius;
for (n = 1; n <= 1000; n = n + 1)
{ j = (sqrt((precision^2) + (aspect_ratio^2 * ((sqrt(1 - (precision * (n - 1))^2) - sqrt(1 - (precision * n)^2))^2))));
k = k + j;
answer = k * major axis * 4; }
print(answer);

_____

Alternatively, on other calculators, you might write it like this:

Σ (n=1,1/★) {√((★^2)+(▲^2*((√(1-(★*(n-1))^2)-√(1-(★*n)^2))^2)))}

The ★ represents the precision (e.g., 0.001), and ▲ is the ratio of the minor axis to the major axis. However, multiplying this result by the major axis and then by 4 gives the circumference of the ellipse.

No customer feedback for this calculation yet.