Cody

# Problem 45979. Compute the perimeter of an ellipse

Solution 2723460

Submitted on 21 Jul 2020 by Ramesh Kumar V
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
a = 3; b = 4; P_correct = 22.103492160709504; assert(abs(ellipsePerim(a,b)-P_correct)/P_correct<1e-8)

p1 = 22.214414690791831 p2 = 22.103491790916742 h = 0.020408163265306 p3 = 22.103492160707660 p4 = 22.103492160709497 y = 22.103492160709497

2   Pass
a = 4; b = 3; P_correct = 22.103492160709504; assert(abs(ellipsePerim(a,b)-P_correct)/P_correct<1e-8)

p1 = 22.214414690791831 p2 = 22.103491790916742 h = 0.020408163265306 p3 = 22.103492160707660 p4 = 22.103492160709497 y = 22.103492160709497

3   Pass
a = 1; b = 8; P_correct = 32.744956600195508; assert(abs(ellipsePerim(a,b)-P_correct)/P_correct<1e-8)

p1 = 35.819667392950713 p2 = 32.725581266452849 h = 0.604938271604938 p3 = 32.744765984936706 y = 32.744956600195508

4   Pass
a = 1; b = 0.974062207869516; P_correct = 6.201967; assert(abs(ellipsePerim(a,b)-P_correct)/P_correct<1e-8)

p1 = 6.202234641148147 p2 = 6.201966999999938 h = 1.726411587318564e-04 p3 = 6.201966999999999 p4 = 6.201966999999999 y = 6.201966999999999

5   Pass
a = 4*rand(1); b = a; P_correct = 2*pi*a; assert(abs(ellipsePerim(a,b)-P_correct)/P_correct<1e-8)

p1 = 22.352676727054831 p2 = 22.352676727054831 h = 0 p3 = 22.352676727054831 p4 = 22.352676727054831 y = 22.352676727054831

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!