Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate perimeter of ellipse

I want to calculate the perimeter of an ellipse with given values for minor and major axis. I'm currently using Python.

I have calculated the minor axis and major axis lengths for the ellipse i.e. a and b.

It’s easy to calculate the area but I want to calculate the perimeter of the ellipse for calculating a rounded length. Do you have any idea?

like image 389
Sagar Gautam Avatar asked Nov 29 '22 22:11

Sagar Gautam


1 Answers

According to Ramanujan's first approximation formula of finding perimeter of Ellipse ->

>>> import math
>>>
>>> def calculate_perimeter(a,b):
...     perimeter = math.pi * ( 3*(a+b) - math.sqrt( (3*a + b) * (a + 3*b) ) )
...     return perimeter
...
>>> calculate_perimeter(2,3)
15.865437575563961

You can compare the result with google calculator also

like image 174
Rezwan4029 Avatar answered Dec 02 '22 11:12

Rezwan4029