2
$\begingroup$

I need to represent the oscillation of a ball within a well. The well is represented by y=x^2 on [-1,1] and the position of the ball is x=Sin[t]. How can I overlay the animation on a static graph? Also what are the correct values of t and y to use?

This is what I have so far:

Animate[Graphics[Point[Table[{x^2, Sin[t]}, {t, -1.57, 1.57}]]], {x, -1, 1}]
$\endgroup$
3
$\begingroup$

I'm not sure if this is what you're looking for based on the code shown. My interpretation of the text of your question would be something like this:

Animate[
  Plot[
    x^2,
    {x, -1, 1},
    Epilog -> {
      AbsolutePointSize[8],
      Point[{Sin[t], Sin[t]^2}]
    }
  ],
  {t, 0, 2 Pi}
]

Animation of a ball in a potential well.

If the position of the ball should be $x = \sin(t)$, then we can determine the y value from the equation for the potential. $y = x^2 = (x)^2 = (\sin(t))^2 = \sin^2(t)$.

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