# How Can I plot two concentric circles with a polygon inscribed in one and circumscribed about the other however I want the polygon to manipulated

So this code is to plot two concentric circles with a polygon inscribed in one and circumscribed about the other:

Manipulate[
Graphics[{Red, Circle[{0, 0}, Cos[Pi/n]], Blue, Circle[{0, 0}, 1],
Green, Line[{Cos[2 Pi #/n], Sin[2 Pi #/n]} & /@ Range[0, n]]}],
{n, 3, 30, 1}]


What can I do to make three additional changes : control the polygon inside in a way that it can be closed or simply lines that end, not necessarily periodic .

To make myself more clear I would want to deal with it like a billiard ball that might make a closed trajectory or a trajectory that ends Any thoughts?

• I don't understand what you mean by making the polygon unclosed, and not necessarily periodic. Could you explain further? May 7, 2016 at 23:28
• "polygon unclosed" - that ain't a polygon anymore, innit? May 8, 2016 at 0:31
• you are right I was not clear enough,, what I mean is that I can control those lines inside in a way it can stay a polygon or become lines. More like a billiard table where the ball might make a closed trajectory or it might hit a corner and end, did you get my point? May 8, 2016 at 1:59
• I edited my question, hope its clearer May 8, 2016 at 2:02

## 1 Answer

Manipulate[
Graphics[{Red, Circle[{0, 0}, Cos[Pi/n]], Blue, Circle[{0, 0}, 1],
Green, Line[{Cos[2 Pi #/n], Sin[2 Pi #/n]} & /@
Range[0, 2 n]]}], {n, 3, 30, .2}]

• Looking more in its details , Actually this is perfect! Thank you May 8, 2016 at 5:34
• Quick question what does .2 in the (n,3,30,.2) stand for. Sorry I am new to mathematica so do not know if it means something specific. And how come when I changed it to 2 the whole thing changed. May 8, 2016 at 5:43
• 2Pi/n is angle at each corner. For regular polygon it is an integer when you write the vertices in parametric form (inside Line[]). Your earlier question was about regular polygon, so I used integral steps for n. It's not Mathematica, rather Mathematics :) May 8, 2016 at 7:17
• thank you . I thought ".2 " was a symbole in mathematica for smth (thought its a mathematica thing) . So from your answer I get its "0.2"? No my question is Just a symbol question not a mathematics one. thanks anyways May 8, 2016 at 11:38
• Sorry but this does not keep the polygon circumscribed about the circle inside, as we increase n the polygon is not longer tangent to the circle? May 16, 2016 at 11:06