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:3:27

the final step to complete our particle simulator is to develop a method to track particle motions forward in time that's how our computer program will animate them one frame at a time we said earlier that if you know the equation of motion of each particle then you can compute the velocities and positions from it by how exactly to answer that question let's go back to the idea of velocity as the slope of the position versus time curve pick two values of time T 1 and T 2 close together and let P 1 be the position at time T 1 and let p to be the position at time T 2 the slope of the line L shown here is a good approximation of the velocity V 1 at time T 1 The Closer that T 2 gets to t 1 the better the approximation as an equation the slope of L that is the velocity V 1 is given by the change in position divided by the change in time if we know the position and velocity at time T 1 then we can compute the position at time T 2 by rearranging this equation to solve for P 2 great so knowing the particles position and velocity at time T 1 we can compute the position at time T 2 using this formula but how do we get the velocity at time T 2 well if we know the equation of motion then we can compute the acceleration at time T 2 for instance if the particle is just being acted on by gravity then the acceleration is constant and is given by the gravitational constant G we also know that the acceleration is the slope of the velocity versus time curve meaning gravity equals the change in velocity divided by the change in time and we can solve this for V 2 now that we know P 2 and V 2 we can repeat this process to compute P 3 and V 3 and so on for as long as we like let's do an example suppose that at the start of the simulation we set our time parameter T to 0 our particle is at Point P 1 with velocity V 1 and the gravity vector G points down to figure out where the particle will be at time T equals one-half we use the equation P 2 is equal to V 1 the quantity T 2 minus T 1 plus P 1 where T 1 is equal to 0 and T 2 is equal to 1/2 so P 2 is equal to 1/2 V 1 plus P 1 meaning that P 2 is halfway between V one's tail and head and to figure out V 2 we use V 2 is equal to G times the quantity t2 minus t1 plus V 1 G here is the gravitational vector which points downward and on earth has a magnitude of 9.8 meters per second squared again T 2 minus T 1 is 1/2 so V 2 is equal to 1/2 G Plus V 1 great now we can compute the position and velocity at t equals 1 using the same formulas although this is rather tedious to do by hand it is relatively easy to write a computer program to do these calculations for us like this congratulations we now have all the parts we need to create a ping-pong ball simulator in the final exercise you can test your understanding of these concepts before moving on to create your own amazing particle simulations