2

Edited at bottom - I think the problem is my unwise expectation to overlay Plot___ over Graphics objects and magically have them scale.

I have an entry-level manipulate that shows how a cycloid is traced by a point on the surface of a rolling wheel. I'm sure I can improve on this (suggestions welcome), but the thing that has me stumped is how to overlay/include an incremental parametric plot of the cycloid itself.

Rolling wheel

Manipulate[
 Graphics[{White, Rectangle[{0, -0.1}, {16, 3}], Blue, 
           Circle[{x, 1}, 1], Red, 
           Disk[{x - Sin[x - 1], 1 - Cos[x - 1]}, 0.1], Black, 
           Line[{{x, 1}, {x - Sin[x - 1], 1 - Cos[x - 1]}}  ],
          }], {x, 1, 14}]

That works the way I want it.

Try as I might, documentation (mis)reading notwithstanding I can't get this cycloid plot (Manipulates by itself without trouble (the arbitrary 22 for upper range is replaced by variable x when I try to embed in the Manipulate.

ParametricPlot[{t - Sin[t - 1], 1 - Cos[t - 1]}, {t, 1, 22}, 
 PlotRange -> {{0, 24}, {0, 2}}]

if I put the ParametricPlot (with x in place of 22) after the closing ] of the Line I get Graphics is not a Graphics primitive or directive.

If I do this (i.e. make the "expr" of Manipulate a List, with element 1= Graphics[... element 2= ParametricPlot... I get a bunch of errors pointing at a variable called FE`x$$261 which shows up in place of the x near the <<

I am missing something here - anything appreciated even RTFM URLs.

Manipulate[
 {Graphics[{White, Rectangle[{0, -0.1}, {16, 3}], Blue, 
    Circle[{x, 1}, 1], Red, 
    Disk[{x - Sin[x - 1], 1 - Cos[x - 1]}, 0.1], Black, 
    Line[{{x, 1}, {x - Sin[x - 1], 1 - Cos[x - 1]}}               ],
    }], 
    ParametricPlot[{t - Sin[t - 1], 1 - Cos[t - 1]}, {t, 1, x},    <<<HERE
    PlotRange -> {{0, 24}, {0, 2}}]}, {x, 1, 14}]

EDIT: I replaced the convenient Disk etc. with actual parametric plots and now have some progress. Won't bore the experts with my incremental learnings - will update this post when I have made as much progress as I can. Ultimately I want to have the cycloid tracing onto the plot as the manipulate-slider progresses

Paul_A
  • 487
  • 2
  • 9

1 Answers1

3

I did something like this using Animate once. Here is a Manipulate version.

enter image description here

Manipulate[
 r = 1;
 Show[{
   ListPlot[Table[{x - Sin[x], 1 - Cos[x]}, {x, 0, t, .1}], 
      Joined -> True, AspectRatio -> Automatic, 
    PlotRange -> {{-3, 20}, {-2 r, 3 r}}, ImageSize -> 500],
   Graphics[{Blue, PointSize[Large], Point[{t - Sin[t], 1 - Cos[t]}]}],
   Graphics[{Red, Circle[{t, 1}, r]}]
   }
  ],
 {{t, 0, "time?"}, 0, 20, .1}
 ]
Nasser
  • 143,286
  • 11
  • 154
  • 359