Message Boards Message Boards

0
|
1169 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Manipulate[ ParametricPlot[ does not produce graphs for defined functions

I have a weird problem to which I cannot figure out the answer. When defining two functions and then using them inside ParametricPlot in a Manipulate, no graph is produced. Pasting the functions directly into ParametricPlot creates the Plot. I tried to use Evaluate, but no success. What am I not getting? Attached is a notebook that shows what works and what does not.

Thanks for any explanation as to what isgoing on.
 x[t_] := R Cos[t] + r Cos[k t]
 y[t_] := R Sin[t] + r Sin[k t]
 
 Manipulate[
  ParametricPlot[{x[t], y[t]}, {t, 0, 2 \[Pi]}, Axes -> True,
   PlotRange -> {{-4, 4}, {-4, 4}},
   PlotStyle -> {Thick, Red}], {{R, 1}, 1, 2}, {{r, .5}, -1,
   2}, {{k, 7}, 1, 11}]
 
(* this one did not work*)

Manipulate[
ParametricPlot[{R Cos[t] + r Cos[k t], R Sin[t] + r Sin[k t]}, {t, 0,
    2 \[Pi]}, Axes -> False, PlotRange -> {{-4, 4}, {-4, 4}},
  PlotStyle -> {Thick, Red}], {{R, 1}, 1, 2}, {{r, .5}, -1,
  2}, {{k, 7}, 1, 11}]

(* This one work s perfectly *)

xx[t_] = R Cos[t] + r Cos[k t];
yy[t_] = R Sin[t] + r Sin[k t];

Manipulate[
ParametricPlot[{xx[t], yy[t]}, {t, 0, 2 \[Pi]}, Axes -> True,
  PlotRange -> {{-4, 4}, {-4, 4}},
  PlotStyle -> {Thick, Red}], {{R, 1}, 1, 2}, {{r, .5}, -1,
  2}, {{k, 7}, 1, 11}]

(*Tried with = instead of := function assignment, but that did not change anything *)
POSTED BY: Silvia Heubach
Dear Silvia,

please do try this:
x[t_] := R Cos[t] + r Cos[k t]
y[t_] := R Sin[t] + r Sin[k t]

Manipulate[
ParametricPlot[{x[t], y[t]} /. {R -> RR, r -> rr, k -> kk}, {t, 0,
   2 \[Pi]}, Axes -> True, PlotRange -> {{-4, 4}, {-4, 4}},
  PlotStyle -> {Thick, Red}], {{RR, 1}, 1, 2}, {{rr, .5}, -1,
  2}, {{kk, 7}, 1, 11}]

Cheers,
M.
POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract