3
$\begingroup$

I'm new and want to animate a point that moves along the polynomial $s(t) = -2.7t^2 + 30t + 6.5$. I've seen examples for polar and parametric plots, but I haven't seen examples of polynomials.

$\endgroup$
  • $\begingroup$ "I've seen examples" - where did you see them? They should not be too hard to modify for your particular case. $\endgroup$ – J. M. is in limbo Oct 24 '17 at 2:22
  • $\begingroup$ you can use the ParametricPlot examples using {t, s[t]} as the first argument. $\endgroup$ – kglr Oct 24 '17 at 2:25
  • 1
    $\begingroup$ Do you mean something like Animate[Show[Plot[s[t], {t, -20, 20}], Graphics[{PointSize[Medium], Point[{u, s[u]}]}]], {u, -20, 20}]? $\endgroup$ – aardvark2012 Oct 24 '17 at 2:40
2
$\begingroup$

It's not too hard to do. To run the animation, you need to open the animation controls by clicking on the plus button on the righthand end of the slider.

s[t_] := -2.7 t^2 + 30 t + 6.5

This is the point that will move along s[t].

pt[t_] := Graphics[{Red, AbsolutePointSize[8], Point[{t, s[t]}]}]

Want to limit the plot to values of s[t] that are positive.

tmax = Max @@ Solve[s[t] == 0, t][[All, 1, 2]]

11.3237

Here the Manipulate code that will allow for both manual and automatic movement (animation) of the point.

Manipulate[
  Show[plot, pt[t]],
  {{t, 0}, 0, tmax, .1, AppearanceElements -> All},
  {{plot, Plot[s[t], {t, 0, tmax}, ImageSize -> 5 72]}, None}]

plot

$\endgroup$
1
$\begingroup$
s[t_] := -2.7 t^2 + 30 t + 6.5;
Dynamic @ Plot[-2.7 t^2 + 30 t + 6.5, {t, 0, 15}, 
  Mesh -> {{Clock[{0, 15}, 2, 2]}}, 
  MeshStyle -> Directive[PointSize[Large], Red]]

enter image description here

Goes through the range 0 to 15 every 2 seconds and stops after 2 iterations.

$\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.