Cody

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

Solution 857888

Submitted on 28 Mar 2016 by George Papazafeiropoulos
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
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 = 8 a = 4.0000 r = 1.0000

2   Pass
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 = 7.7942 r = 1.5000

3   Pass
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 = 12.4233 a = 12.0000 r = 1.9319

4   Pass
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 = 15.5885 a = 11.6913 r = 1.5000

5   Pass
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 = 56.5190 a = 253.9354 r = 8.9858

6   Pass
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 = 12.5643 a = 12.5579 r = 1.9990