I am fairly new to Mathematica, and I cannot figure out how to plot an epicycloid. I have plotted some neat looking things in my attempts, but I still can't make one. I am not looking to make an animation; I just want the plot of an epicycloid.
Would I use PolarPlot
or ParametricPlot
? How do I get a static picture of an epicycloid?
Answer
I recreated the animation on Wikipedia:
Here is the Manipulate
version:
R = 3; r = 1;
fx[θ_, a_: 1] := (R + r) Cos[θ] - a r Cos[(R + r) θ/r];
fy[θ_, a_: 1] := (R + r) Sin[θ] - a r Sin[(R + r) θ/r];
gridlines = Table[{x, GrayLevel[0.9]}, {x, -6, 6, 0.5}];
plot[max_] := ParametricPlot[
{fx[θ], fy[θ]}, {θ, 0, max},
PlotStyle -> {Red, Thick},
Epilog -> {
Thick,
Blue, Circle[{0, 0}, R],
Black, Circle[{fx[max, 0], fy[max, 0]}, r],
Red, PointSize[Large], Point[{fx[max], fy[max]}],
Black, Line[{{fx[max, 0], fy[max, 0]}, {fx[max], fy[max]}}]
},
GridLines -> {gridlines, gridlines},
PlotRange -> {-6, 6}
]
Manipulate[plot[max], {max, 0.01, 2 Pi}]
Comments
Post a Comment