Rotating a circle about a larger circle
Just for fun:
Setup:
clock = Graphics[{Circle[{0, 0}, 2],
Table[{Text[ Mod[3 - 6 j/Pi, 12, 1], 1.65 {Cos[j], Sin[j]}],
Line[# {Cos[j], Sin[j]} & /@ {1.8, 2}]}, {j, 0, 23 Pi/12,
Pi/6}], PointSize[0.02], Point[{0, 0}]}];
epi[t_] := 3 {Sin[t], Cos[t]} + {Sin[3 t], Cos[3 t]}
Visualization:
Manipulate[
Show[ParametricPlot[epi[t], {t, 0, 2 Pi},
Epilog -> {Red, PointSize[0.02], Point[epi[j]]},
PlotStyle -> Dashed], clock,
Graphics[{Circle[3 {Sin[j], Cos[j]}, 1],
Text[Rotate[Style["\[DoubleUpArrow]", 40], -3 j],
3 {Sin[j], Cos[j]}]}], Axes -> None,
PlotRange -> {{-4, 4}, {-4, 4}}], {j, 0, 2 Pi}]
I think you are right, there is a mistake in the reasoning of my now deleted answer. However, I thought some the cosmetic code I wrote for the failed answer might still be of interest to you, so I integrated your code with the cosmetic elements of mine.
R = 20; r = 10;
fy[θ_, a_: 1] := (R + r) Cos[θ] + a r Cos[(R + r) θ/r];
fx[θ_, a_: 1] := (R + r) Sin[θ] + a r Sin[(R + r) θ/r];
origin = {0, 0};
center = {PointSize[Large], Point[origin]};
scale = Range[12];
scalePts = R {Sin @ #, Cos @ #}& /@ N[(30 scale) °];
ticks = Line @ ({#, .9 #}& /@ scalePts);
lbls = Thread[Text[Style[#, 14]& /@ scale, .8 scalePts]];
plot[max_] :=
ParametricPlot[{fx[θ], fy[θ]}, {θ, 0, max},
PlotStyle -> {Red, Thick},
Axes -> False,
PlotRange -> 40]
Manipulate[
Block[{θ = max °},
Show[
If[θ > 0., plot[θ ], Graphics[{}, PlotRange -> 40]],
Graphics[{
Thick, Blue, Circle[origin, R],
Black, center, lbls, ticks, Circle[{fx[θ, 0], fy[θ, 0]}, r],
Red, PointSize[Large], Point[{fx[θ], fy[θ]}],
Green, PointSize[Large], Point[{fx[θ, -1], fy[θ, -1]}],
Black, Line[{{fx[θ, 0], fy[θ, 0]}, {fx[θ], fy[θ]}}]}],
PlotRangePadding -> 2]],
{max, 0., 360., 5., Appearance -> "Labeled"}]
With these changes, your demonstration will look like this
which is more in line with the top image of your question. I hope you find some use for this in your classroom.
Major edit
Yes, it is possible to save the phenomena and work only with rotating circles, eschewing any reference to epicycles. (Of course, they are still there.)
I will do it in two steps.
A helper function that will generate the graphics primitives for the rolling circle.
roller[r1_, r2_, angle_] := Module[{r3 = r1 + r2, center}, center = r3 {Sin @ angle, Cos @ angle}; {Circle[center, r2], Rotate[Arrow[{center - {0, r2}, center + {0, r2}}, .2], -angle r3/r2]}]
Note that the only change from my previously posted, wrong version is to substitute
r3
forr1
.roller
will work for cicles of any radius,r1 > r2
An
Manipulate
expression that draws the larger circle in the background and uses the helper to rotate the smaller circle.Manipulate[ With[{r1 = 2., r2 = 1.}, Module[{origin, halfW, center, scale, scalePts, ticks, lbls}, origin = {0, 0}; halfW = r1 + 2 r2; center = {PointSize[Large], Point[origin]}; scale = Range[12]; scalePts = r1 {Sin @ #, Cos @ #} & /@ N[(30 scale) °]; ticks = Line @ ({#, .925 # } & /@ scalePts); lbls = Thread[Text[Style[#, 14] & /@ scale, .8 scalePts]]; Graphics[{roller[r1, r2, θ °]}, PlotRange -> {{-#, #}, {-#, #}} &[halfW], Prolog -> {Circle[origin, r1], center, lbls, ticks}]]], {θ, 0., 360., 5., Appearance -> "Labeled"}, SaveDefinitions -> True]
The above code produces a demonstration that looks like this as it hits the four o'clock point.