0
$\begingroup$

I have just started to learn Mathematica. I want to see how can I generate animations in Mathematica. For example, the I want to plot an equation $$x(t)=5\cos(10t)\tag{1}$$ which I can do. But suppose I interpret $t$ as the time, and $x(t)$ the position of the particle at time $t$, how can I generate an animation which showing a ball changing its position with time according to (1)?

$\endgroup$
5
$\begingroup$

Try something like this:

Animate[
  Show[
    Plot[5 Cos[10 u], {u, 0, Pi}, AspectRatio -> 1, PlotRange -> 10],
    Graphics[{Red, PointSize[0.04], Point[{t, 5 Cos[10 t]}]}]
  ],
  {t, 0, Pi}
]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ With Point[Dynamic@{t, 5 Cos[10 t]}] only coordinates will need to be updated instead of the whole plot. $\endgroup$ – Kuba May 1 '18 at 19:46

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