Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Hypocycloids are curves generated by following a fixed point on a smaller circle rolling around the inside of a larger circle.

The following code is from the recent book of P. Wellin (with modified PlotRange by myself).

HypocycloidPlot[R_, r_, θ_] := 
 Module[{Hypocycloid, center}, 
  Hypocycloid[{a_, b_}, 
    t_] := {(a - b) Cos[t] + b Cos[t (a - b)/b], (a - b) Sin[t] - 
     b Sin[t (a - b)/b]}; 
  center[{a_, b_}, t_] := (a - b) {Cos[t], Sin[t]}; 
  Show[{ParametricPlot[Hypocycloid[{R, r}, t], {t, 0, θ}, 
     Axes -> None, PlotStyle -> Red], 
    Graphics[{{Blue, Thick, Circle[{0, 0}, R]}, 
      Circle[center[{R, r}, θ]], {Thick, 
       Line[{center[{R, r}, θ], Hypocycloid[{R, r}, θ]}]}, {Orange, 
       PointSize[0.02], Point[center[{R, r}, θ]]}, {Red, 
       PointSize[0.03], Point[Hypocycloid[{R, r}, θ]]}}]}, 
   PlotRange -> 1.5 (R + r), GridLines -> Automatic]]

For instance,

Table[HypocycloidPlot[R, 1, 
   θ], {R, {3, 7/2, Sqrt[7/2]}}, {θ, {Pi/3, 3 Pi/2, 2 Pi, 
    3 Pi}}] // TableForm

produces the following

enter image description here

(It can be verified that the curve only "closes up" when the ratio R/r is an integer or a rational number.)

My first question.

If we set R = 3 and r = 2, for example, the inner circle loses the contact with the outer circle. (The author does not pose any restricition to r.) I think the problem arises due to the fixed center of the outer circle

Circle[{0, 0}, R]

Am I correct or am I missing something? And if I am indeed correct, how should the code be modified in order to circumvent the issue?

My second question. Suppose that I have the following

Manipulate[
 HypocycloidPlot[R, r, θ], {θ, 0.01, 
  2 π Denominator[(R - r)/r]}, {R, {3, 4, 5, 6, 7, 8, 5/3, 7/2}, 
  Setter}, {r, Range[5], Setter}]

How can I make videos like the following one?

http://en.wikipedia.org/wiki/Hypocycloid

Update

The thread is relating to Plotting an epicycloid

There my second answer about animation is answered. So, it remains only the first one.

share|improve this question

closed as off-topic by Pickett, m_goldberg, ubpdqn, Michael E2, Sjoerd C. de Vries Jul 18 at 13:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Pickett, m_goldberg, ubpdqn, Michael E2, Sjoerd C. de Vries
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 3 down vote accepted

For the first question the problem is only in the radius of the small circle. it should be like this:

Circle[center[{R, r}, θ], r]
share|improve this answer

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