1

For a program that I am writing, I need a function that takes in the number of sides, and the diameter, and will output side length. I have tried to ask my teachers, but none of them had time to figure it out.

I first tried this equation, d being the diameter (from the center to a vertex) and n being the number of sides:
$$ d\cdot2\cdot\tan\left(\frac{n}{180}\right) $$

That is the only thing that I really tried. I also tried a scaling factor, but that would never work for all values of $n$. I could not find anything else that looked like it would work.

  • Welcome to [math.se] SE. Take a [tour]. You'll find that simple "Here's the statement of my question, solve it for me" posts will be poorly received. What is better is for you to add context (with an [edit]): What you understand about the problem, what you've tried so far, etc.; something both to show you are part of the learning experience and to help us guide you to the appropriate help. You can consult this link for further guidance. – Another User Nov 08 '23 at 21:42
  • I updated the question, so hopefully it is better – inyourface3445 Nov 08 '23 at 22:21
  • 1
    What do you mean by "diameter"? Is the unit square's diameter $1$ or $\sqrt2$? Is the unit-edge triangle's diameter $1$ or $\sqrt3/2$? – mr_e_man Nov 08 '23 at 23:23
  • @inyourface3445 - The diameter could be that of the circumscribed circle, or that of the inscribed circle, or the greatest distance between two points in the polygon, or the smallest distance between two parallel lines enclosing the polygon. All four are different, at least for odd $n$. – mr_e_man Nov 09 '23 at 01:02

0 Answers0