1

Let $P$ be a particle moving on the circumference of a circle, of unit radius, such that at time $t$ the particle is displaced through an angle $\psi(t)=\sin(0.5t)$ from its rest position. It would be useful to have an animated plot of the trajectory of the particle. How does one go about producing this?

RB98
  • 11
  • 1

2 Answers2

2

Try

Animate[
 Graphics[{
   Circle[], PointSize[0.04], Red, Point[{Cos[0.5 t], Sin[0.5 t]}]},
  PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}],
 {t, 0, 100, 0.1}, AnimationRate -> 4
 ]

Mathematica graphics

You may wish to play with the colour, increment and AnimationRate. Look up Animate.

Reading your question again did you mean this?

Animate[
 Graphics[{
   Circle[], PointSize[0.04], Red, 
   Point[{Cos[Sin[0.5 t]], Sin[Sin[0.5 t]]}]},
  PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}],
 {t, 0, 100, 0.1}, AnimationRate -> 4
 ]

Same picture but now the particle oscillates.

Hugh
  • 16,387
  • 3
  • 31
  • 83
2

You can also make a gif of it

Table[
  Graphics[
   {
    {Thickness[.006], Circle[]},
    {PointSize[.03], Red, {Cos@#, Sin@#} &@Sin[.5 t] // Point}
    }
   ],
  {t, 0, 4 \[Pi], (4 \[Pi])/100}
  ];
ListAnimate@%
SetDirectory["YourDirectory"]; Export["Oscillator.gif", %%]

enter image description here

where we have $0 \leq t \leq 4 \pi$ because the period of $\sin(0.5 t)$ is $T = 4 \pi$.

NonDairyNeutrino
  • 7,810
  • 1
  • 14
  • 29
  • Yes better than mine. Why do you only go to 2Pi? If you go to further the oscillation can go in the lower part of the circle. – Hugh Oct 09 '18 at 19:57
  • @Hugh You're right, that was just a habit because I've made this animation quite a few times, but always with the period of $2 \pi$, whereas the period in this case is $4\pi$. I'll change it. – NonDairyNeutrino Oct 09 '18 at 20:02