Cody

# Problem 42789. Regular polygon bounded by and bounding a circle

Solution 2668151

Submitted on 8 Jul 2020
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   Fail
R = sqrt(2); n = 4; [p,a,r] = BoundedPolygon(R,n) p_correct = 8; a_correct = 4; r_correct = 1; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

p = 5.6569 a = 32.0000 r = 0.7071

Assertion failed.

2   Fail
R = sqrt(3); n = 6; [p,a,r] = BoundedPolygon(R,n) p_correct = 10.3923; a_correct = 7.7942; r_correct = 1.5; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

p = 10.3923 a = 108 r = 0.8660

Assertion failed.

3   Fail
R = 2; n = 12; [p,a,r] = BoundedPolygon(R,n) p_correct = 12.4233; a_correct = 12; r_correct = 1.9319; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

p = 24 a = 576 r = 1

Assertion failed.

4   Fail
R = 3; n = 3; [p,a,r] = BoundedPolygon(R,n) p_correct = 15.5885; a_correct = 11.6913; r_correct = 1.5; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

p = 9 a = 81 r = 1.5000

Assertion failed.

5   Fail
R = 9; n = 56; [p,a,r] = BoundedPolygon(R,n) p_correct = 56.519; a_correct = 253.9354; r_correct = 8.9858; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

p = 504 a = 254016 r = 4.5000

Assertion failed.

6   Fail
R = 2; n = 99; [p,a,r] = BoundedPolygon(R,n) p_correct = 12.5643; a_correct = 12.5579; r_correct = 1.999; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

p = 198 a = 39204 r = 1

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!