1
$\begingroup$

I want to make my function trace the hypotrochoid through one period of its motion and trying to change the color of the trace, color of the radius, and change the color of the dot on it so I can view it easier

I have came up with this following function

 hypotrochoid[a_, b_, h_,t_] := {(a - b) Cos[t] + h Cos[(a - b)/b t], (a - b) Sin[t] - 
h Sin[(a - b)/b t]};

 myfigure[a_, b_, h_]:=Manipulate[ParametricPlot[hypotrochoid[a, b, h, t], {t, 0, c*2 \[Pi]},PlotRange -> {{-(a + b + h + 1/4), a + b + h + 1/4}, {-(a + b + h + 1/4), a + b + h + 1/4}}], {c, -1, 1}]

Though when I test it on

myfigure[5, 1, 1/2]

Nothing shows up on this testing. I know I do not have the coloring but not certain of the syntax require.

$\endgroup$
8
  • $\begingroup$ Post complete code. Where's definition for hypotrochoid? $\endgroup$
    – RunnyKine
    Nov 16, 2013 at 4:57
  • $\begingroup$ Posted forgot about that $\endgroup$
    – thaibak527
    Nov 16, 2013 at 5:01
  • $\begingroup$ It works for me. You may want to restart the kernel. $\endgroup$
    – RunnyKine
    Nov 16, 2013 at 5:04
  • $\begingroup$ error message: ParametricPlot::prng: Value of option PlotRange -> {{-6,6},{{-6},6}} is not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. >> $\endgroup$
    – thaibak527
    Nov 16, 2013 at 5:05
  • $\begingroup$ Please restart your Mathematica session and try again. $\endgroup$
    – RunnyKine
    Nov 16, 2013 at 5:07

1 Answer 1

2
$\begingroup$

For coloring try:

myfigure[a_, b_, h_] := Manipulate[
  ParametricPlot[
   hypotrochoid[a, b, h, t], {t, 0.0000001, c*2 \[Pi]},
   PlotRange -> {
     {-(a + b + h + 1/4), a + b + h + 1/4},
     {-(a + b + h + 1/4), a + b + h + 1/4}
     },
   PlotStyle -> plotColor,
   Prolog -> {circleColor,
     Circle[{0, 0}, a]},
   Epilog -> {dotColor,
     Disk[hypotrochoid[a, b, h, 2 Pi c ], .2]
     }
   ],
  {c, -1, 1},
  {{plotColor, Red, "Trace"}, Red},
  {{dotColor, Blue, "Dot"}, Blue},
  {{circleColor, Gray, "Circle"}, Gray}
  ]

weirdly down-sampled GIF animation

$\endgroup$
3
  • $\begingroup$ very nice...if it is not intrusive, what do you use for screen capture...do you then import into mathematica and convert to animated gif or use other converter? $\endgroup$
    – ubpdqn
    Nov 17, 2013 at 12:57
  • $\begingroup$ @ubpdqn this one. Sometimes I import them for editing (removing frames from the end or beginning, for example). $\endgroup$
    – cormullion
    Nov 17, 2013 at 13:54
  • $\begingroup$ Ah very nice, I'll go play around with that syntax and try some stuff, many thanks. $\endgroup$
    – thaibak527
    Nov 17, 2013 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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