MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: "particle" sliding along a curve

  • To: mathgroup at
  • Subject: [mg70542] RE: [mg70516] "particle" sliding along a curve
  • From: "David Park" <djmp at>
  • Date: Thu, 19 Oct 2006 03:22:05 -0400 (EDT)

First define a single frame for the animation and then animate it.


frame[t_] := Plot[x^2, {x, -10, 10},
    Epilog -> {AbsolutePointSize[6], Point[{t, t^2}]},
    Frame -> True, Axes -> False, ImageSize -> 400];

Animate[frame[t], {t, -5, 5, 0.2}]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1,
      AnimationDirection -> ForwardBackward]}]

Usually when making an animation it is necessary to explicitly give the
PlotRange so that all frames will have the same PlotRange. In this case the
larger parabola gives the same PlotRange for all frames.

When developing an animation you can also simply evaluate frame[0], or some
specific time, to touch up the frame plot without doing the entire

David Park
djmp at

From: Mattiephly at [mailto:Mattiephly at]
To: mathgroup at

Hi there.  I'd like to create a Mathematica plot that displays a
"particle" -- which will just be a small, black circle -- "sliding"
along a curve.  That is, when I execute the Plot command, I'd like to
watch as the particle moves along the curve from one point to another.
I've looked at the help documents for the built in Animation abilities,
but I'm not sure how to make use of them.  Do I really have to create a
single plot for several positions of the particle, and then animate
those consecutively?

For example, I'd like my particle to slide along the parabola y = x^2,
and I'd like the particle to "slide" from x = -5 to 5 (though maybe
show the curve from x = -10 to 10).  And I'd like to be able to control
the "speed" of the particle, too.

I appreciate any thoughts on this.

Thanks a lot,

  • Prev by Date: Re: damped oscilations data fit
  • Next by Date: Re: "particle" sliding along a curve
  • Previous by thread: Re: "particle" sliding along a curve
  • Next by thread: Re: "particle" sliding along a curve