MathGroup Archive 2006

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

Search the Archive

Re: "particle" sliding along a curve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70559] Re: "particle" sliding along a curve
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Thu, 19 Oct 2006 03:23:28 -0400 (EDT)

On 10/18/06 at 4:17 AM, Mattiephly at hotmail.com wrote:

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

This is easy to achieve. The following code will generate a 
series of plots that can be automated

In[5]:=
Table[Plot[x^2, {x, -10, 10}, Epilog ->
      {Red, PointSize[0.02], Point[{n, n^2}]}],
    {n, -5, 5}];

Once the plots have been generated, select them all by clicking 
on the square blue bracket on the right side of the notebook 
window and double clicking it. That will collapse the graphics 
so that only the first shows.

Once this is done, simply move the cursor to the graphic and 
double click to start the animation.

The speed at which the particle appears to move can be 
controlled by clicking on the "arrow" icons that appear at the 
bottom of the notebook window when the animation runs. 
Additional control of the speed can be achieved by changing the 
plot increment. For example, changing the code to be

Table[Plot[x^2, {x, -10, 10}, Epilog ->
      {Red, PointSize[0.02], Point[{n, n^2}]}],
    {n, -5, 5, .5}];

Will generate twice as many plots making the apparent particle 
speed 1/2 what it was.
--
To reply via email subtract one hundred and four


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