Problem 59249. Compute the total length of lines between all vertices of a regular polygon

Write a function to compute the total length of between all vertices of a regular polygon inscribed in a unit circle. For example, a square in a unit circle would have side length of sqrt(2) and each of the two diagonals would have a length of 2. Therefore, for n = 4 the total length is 4(1+sqrt(2)). In the hexagon below, there are 6 lines of length 1 connecting adjacent points, 3 lines of length 2 connecting opposite points, and 6 lines of length sqrt(3) connecting points two away; therefore, for n = 6, the total length is 6(2+sqrt(3)).
hexagon

Solution Stats

88.89% Correct | 11.11% Incorrect
Last Solution submitted on Jan 08, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers6

Suggested Problems

More from this Author281

Community Treasure Hunt

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

Start Hunting!