0
$\begingroup$

Here is my code so far:

p1 = 
   Manipulate[
     ParametricPlot[
       {2(n - 1)Cos[t] + 2Cos[(n - 1)t], 2(n - 1)Sin[t] - 2Sin[(n - 1)t]}, 
       {t, 0, 2 Pi}], {n, 2, 10, 1}]
p2 = ParametricPlot[{8 Cos[t], 8 Sin[t]}, {t, 0, 2π}]
Show[p1, p2]

but it just prints separate equations

$\endgroup$
1
$\begingroup$

Just put them in same Manipulate. Do not use output of Manipulate inside Show.

Manipulate[
 Module[{p1, p2},
  p2 = ParametricPlot[{8 Cos[t], 8 Sin[t]}, {t, 0, 2 \[Pi]}];
  p1 = ParametricPlot[{2 (n - 1) Cos[t] + 2 Cos[(n - 1) t], 
     2 (n - 1) Sin[t] - 2 Sin[(n - 1) t]}, {t, 0, 2 Pi}];
  Show[p2, p1]
  ],
 {n, 2, 10, 1}
 ]

Mathematica graphics

Or since p1 does not depend on n you can calculate it once

Manipulate[
 Module[{p1,t},
  p1 = ParametricPlot[{2 (n - 1) Cos[t] + 2 Cos[(n - 1) t], 
     2 (n - 1) Sin[t] - 2 Sin[(n - 1) t]}, {t, 0, 2 Pi}];
  Show[p2, p1]
  ],
 {n, 2, 10, 1},
 Initialization :> (p2 = 
    ParametricPlot[{8 Cos[t], 8 Sin[t]}, {t, 0, 2 \[Pi]}])
 ]
$\endgroup$
  • $\begingroup$ Thank you. That was very useful! $\endgroup$ – The Math Guy Apr 28 at 0:33
0
$\begingroup$

Actually, since ParametricPlot can display multiple parametric curves, you could just write this simple Manipulate expression:

Manipulate[
  ParametricPlot[
    {{2 (n - 1) Cos[t] + 2 Cos[(n - 1) t], 2 (n - 1) Sin[t] - 2 Sin[(n - 1) t]},
     {8 Cos[t], 8 Sin[t]}},
    {t, 0, 2 Pi}],
  {n, 2, 10, 1}]

demo

$\endgroup$

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.