If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains ***.kastatic.org** and ***.kasandbox.org** are unblocked.

Main content

Current time:0:00Total duration:2:57

in this lesson we'll revisit our ping-pong ball simulator but this time from a mathematical or quantitative perspective by the end of the lesson you'll learn everything you need to code up your own ping pong ball simulator and much more specifically we're going to develop mathematical formulas to do three things 1 describe how particles move based on laws of physics to control how particles collide with the walls of the container and with each other 3 create a method to track particle motion forward in time to begin to understand how particles move let's draw different kinds of motion by motion we mean how the position of particles will change over time we got an idea of how things move in our animation lesson in that lesson we animated the ball by drawing it in different positions over time using each frame indicated at the bottom of the screen if we draw the ball moving an equal distance between each frame it looks like it's sliding along a frictionless surface the speed isn't changing its constant if we plot the position of the ball over time we get a straight line here time is expressed on the horizontal axis and the distance the ball has moved is plotted on the vertical axis the slope of the line tells us how fast it's moving a steeper slope means a higher speed the slope is a change in position divided by the change in time now what if we wanted to plot the ball speed over time if the ball speed doesn't change at all we get a plot like this a straight horizontal line a harder challenge is animating the ball so it actually looks like it's being acted upon by gravity to do that we have to increase the distance that the ball travels between each frame this is because the ball needs to speed up as it falls and we plot the ball's position over time we get a curve this is because at each frame we are changing the slope of the line now if we plot the speed of the ball over time we get a non horizontal line that's telling us that the ball speed is no longer constant the slope of the line is telling us how fast the ball speed is changing and just like we plotted the change in position to get the ball speed we can plot the change in speed to get the acceleration the ball here is a plot of the ball's acceleration versus time notice it's a straight line which means the acceleration isn't changing and that's because the acceleration due to gravity is constant to summarize speed is the slope of the ball's position versus time curve similarly acceleration is the slope of the speed versus time curve as shown in these equations speed is equal to change in position divided by change in time and acceleration is equal to change in speed divided by change in time but let's pause here in the next exercise we'll challenge you to think about how the motion of objects changes over time in terms of position speed and acceleration