+
Making Animations with Potential Energy

Specialized Glowscript material developed by W. Brian Lane - Published September 24, 2019

This exercise set helps students explore the relationship between potential energy and motion using an extension of the Euler-Cromer method and the gradient relationship $\vec{F} = -\nabla U$ between force and potential energy. The resulting animations provide a dynamic demonstration of conservation of energy in three-dimensional space and help students qualitatively study bound states and scattering states. After exploring standard potential energy functions (harmonic oscillator, gravitation, and electrostatic), students develop, study, and share a potential energy function of their choosing.
Subject Area Mechanics
Levels First Year and Beyond the First Year
Specialized Implementation Glowscript
Learning Objectives
Students who complete this Exercise Set will be able to: * Describe the relationship between force and potential energy. (Exercise 1) * Distinguish between a scattering state and a bound state in a classical system. (Exercises 2-5) * Describe the motion of an object under the influence of a spring potential energy in one and two dimensions. (Exercise 2) * Explain why there are no scattering states in a spring potential energy. (Exercise 2) * Describe the motion of an object under the influence of a gravitational potential energy in two dimensions. (Exercise 3) * Explain why there are both scattering and bound states in a gravitational potential energy. (Exercise 3) * Describe the motion of an object under the influence of an electrostatic potential energy (attractive, repulsive, and a combination of the two) in two dimensions. (Exercise 4) * Explain why there may be only scattering states, only bound states, or both scattering or bound states in an electrostatic potential energy. (Exercise 4) * Design a potential energy function in two dimensions. (Exercise 5) * Study their designed potential energy function. (Exercise 5). * Determine whether their designed potential energy function has scattering states, bound states, or both. (Exercise 5).
Time to Complete 60-90 min
# Exercise 1 You have seen previously that an unbalanced force on an object causes a change in that object's momentum, such that the object's motion is governed by a two-step update procedure: $$\begin{align} \vec{p} & \rightarrow \vec{p} + \vec{F} \Delta t \\ \vec{r} & \rightarrow \vec{r} + \frac{\vec{p}}{m} \Delta t \end{align}$$ where $\Delta t$ is a small step forward in time. By repeating this process in a computer code, you can create a physics-based animation. In addition to forces, we can also think of changes in an object's motion as being caused by a **potential energy** $U$. Potential energy is related to force through a **derivative**: $$ \vec{F} = \left\langle -\frac{dU}{dx}, -\frac{dU}{dy}, -\frac{dU}{dz} \right\rangle $$ Of course, the derivative can be approximated with a slope: $$ \vec{F} = \left\langle -\frac{\Delta U}{\Delta x}, -\frac{\Delta U}{\Delta y}, -\frac{\Delta U}{\Delta z} \right\rangle $$ which we can implement in a computer code along with the update procedure. Open the code motion-with-PE and answer the following questions. 1. Where (in what line) and how (using what mathematical steps) does the code implement the update procedure? 2. Where (in what line) and how (using what mathematical steps) does the code calculate force from potential energy? You might notice that the code limits itself to motion along the $x$ and $z$ directions. It's been set up this way so that the $y$ direction represents the height and depth of the potential energy, which will be displayed in the code as a grid. Run the code to see what this means. 3. Describe the shape of the potential energy surface (shown as a grid) in the animation. (Rotate, zoom, and pan the view as needed. You can rotate by holding the right mouse button while moving the cursor; you can zoom using the mouse scroll wheel; and you can pan by holding Shift and the left mouse button while moving the cursor.) This grid is created in Lines 20 through 40, using a ``curve`` object to create each line of the grid. The ``curve`` object connects a list of points with lines, as described on https://www.glowscript.org/docs/GlowScriptDocs/curve.html. By looping over points in the $xz$-plane, this code creates a set of ``curve`` objects running along the $x$-axis and $z$-axis, with their $y$ position given by the potential energy function. 4. Describe the motion of the ball on the potential energy surface. 5. Add graphs of the ball's kinetic energy $K$, the potential energy function $U$, and the total system energy $E = K+U$ to the code. You will find these graphs helpful in the Exercises that follow. To create graphs in Glowscript... * Create a gcurve for each energy value you want to graph. You'll need to give each gcurve a name; so, for the ball's kinetic energy, you would need something like ``ke_graph = gcurve(color=color.red,label="kinetic energy")``. Create your three gcurve's **before** the animation loop. * Calculate the three energy values **in** the animation loop. As a reminder, kinetic energy can be calculated using ``ke = mag(ball.momentum)**2/(2*ball.mass)``, and you already have the potential energy function defined. * Finally, use the ``plot`` command **in** the animation loop to add the most recent energy values to the graph. For example, for the ball's kinetic energy, you would need something like ``ke_graph.plot(time,ke)``. Before moving on, you might notice that the animation loop will continue to run until you close the animation window. If you want to set the animation to run for a specified amount of time (for example, if you want to take a screenshot of the energy graphs after a certain time), you can change True in line 56 to t < tmax, where tmax is the amount of time you want the animation to run. # Exercise 2 The potential energy in the motion-with-PE models a spring in the $x$ and $z$ directions. You can think of this as a spring with one end attached to the ball and one end fixed at the origin. 1. Edit the starting code to adjust the ball's initial position and initial momentum. What kind of shapes can you create with its trajectory? As always, if the ball's motion becomes jagged, decrease the time step ``dt``. 2. Can you give the ball enough initial momentum to escape the potential energy and fly away to infinity? If you can, what combination of initial position and initial momentum was successful? If not, propose an explanation as to why. **Hint**: Think in terms of energy! Watch your energy graphs. As always, if the ball's motion becomes jagged, decrease the time step ``dt``. # Exercise 3 Hopefully by now you determined that the spring potential energy can never be escaped, since it continues up indefinitely. When the ball's trajectory cannot leave a certain region, we call this a **bound state**. When a ball's trajectory is allowed to travel out to infinity, we call this a **scattering state**. While the spring potential energy can only have bound states, it is possible for a potential energy to have both. 1. Change the potential energy calculation in your code to ``pe = -1/sqrt(posn.x**2 + posn.z**2)``. This is the equation for gravitational potential energy in space. 2. Run the code. Describe the shape of the potential energy surface and the motion of the ball. Again, rotate, zoom, and pan the view as needed. As always, if the ball's motion becomes jagged, decrease the time step ``dt``. 3. Adjust the ball's initial position and initial momentum until you create a bound state. Describe the motion of the ball. Why is this a bound state? **Hint**: Think in terms of energy. Watch your energy graphs. As always, if the ball's motion becomes jagged, decrease the time step ``dt``. 4. Adjust the ball's initial position and initial momentum until you create a scattering state. Describe the motion of the ball. Why is this a scattering state? **Hint**: Think in terms of energy. Watch your energy graphs. As always, if the ball's motion becomes jagged, decrease the time step ``dt``. # Exercise 4 Now let's explore how it's possible for a potential energy to have only scattering states. 1. Change the potential energy calculation in your code to ``pe = 1/sqrt((posn.x+0.5)**2 + posn.z**2) + 1/sqrt((posn.x-0.5)**2 + posn.z**2)``. This is the equation for the potential energy created by two electrostatic charges that repel the ball. 2. Run the code. Describe the shape of the potential energy surface and the motion of the ball. Again, rotate, zoom, and pan the view as needed. As always, if the ball's motion becomes jagged, decrease the time step ``dt``. 3. Adjust the ball's initial position and initial momentum until you create a bound state. If you can't, explain why not. **Hint**: Think in terms of energy. Watch your energy graphs. As always, if the ball's motion becomes jagged, decrease the time step ``dt``. 4. Adjust the ball's initial position and initial momentum until you create a scattering state. Describe the motion of the ball. Why is this a scattering state? **Hint**: Think in terms of energy. Watch your energy graphs. As always, if the ball's motion becomes jagged, decrease the time step ``dt``. # Exercise 5 Now it's time for you to create something new: Change the potential energy calculation to a function of $x$ and $z$ of your choosing. You could take one of the previous potential energies and modify it significantly (i.e., change more than just the numbers involved), or you could introduce a new function entirely. You are encouraged to be as creative you like. As you proceed, keep in mind that the potential energy surface in the animation may become jagged; when this happens, decrease the value of dx under the section labeled ``# Make PE landscape (AKA rubber sheet).`` to smooth out the image. And, as always, if the ball's motion becomes jagged, decrease the time step ``dt``. Once you have constructed a potential energy of your liking, answer the following questions: 1. Can your potential energy have bound states? If so, provide an example of a bound state. If not, explain why. 2. Can your potential energy have scattering states? If so, provide an example of a scattering state. If not, explain why. 3. Share your potential energy shape, bound state (if you found one), and scattering state (if you found one) with the class. If you could not find a bound state or a scattering state, explain why to the class.

Download Options

Share a Variation

Did you have to edit this material to fit your needs? Share your changes by Creating a Variation

Credits and Licensing

W. Brian Lane, "Making Animations with Potential Energy," Published in the PICUP Collection, September 2019.

The instructor materials are ©2019 W. Brian Lane.

The exercises are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license