1
$\begingroup$

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?

$\endgroup$
4
  • 2
    $\begingroup$ I don't understand what you mean by making the polygon unclosed, and not necessarily periodic. Could you explain further? $\endgroup$
    – MarcoB
    May 7, 2016 at 23:28
  • 1
    $\begingroup$ "polygon unclosed" - that ain't a polygon anymore, innit? $\endgroup$ May 8, 2016 at 0:31
  • $\begingroup$ 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? $\endgroup$
    – Sarah
    May 8, 2016 at 1:59
  • $\begingroup$ I edited my question, hope its clearer $\endgroup$
    – Sarah
    May 8, 2016 at 2:02

1 Answer 1

1
$\begingroup$
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}]
$\endgroup$
5
  • $\begingroup$ Looking more in its details , Actually this is perfect! Thank you $\endgroup$
    – Sarah
    May 8, 2016 at 5:34
  • $\begingroup$ 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. $\endgroup$
    – Sarah
    May 8, 2016 at 5:43
  • $\begingroup$ 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 :) $\endgroup$
    – Sumit
    May 8, 2016 at 7:17
  • $\begingroup$ 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 $\endgroup$
    – Sarah
    May 8, 2016 at 11:38
  • $\begingroup$ 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? $\endgroup$
    – Sarah
    May 16, 2016 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.