Pretty much everyone has bounced a ball at one point in time. You might think it’s a very simple physics problem — and it is quite simple. But it’s also very complex. You can make it as complicated as you like.
I’m going to start off with the simplest bouncing ball and model it in python. Then we can slowly make it more and more complicated until we decide to stop. Let’s get to it.
A Bouncing Point Mass
What’s simpler than a bouncing ball? What about a falling ball that never hits the ground?
Suppose I have a ball with a mass of 0.1 kilograms that is released from rest above a floor at a height of 1 meter. The only force on the ball (assuming air resistance is negligible) would be the downward gravitational force.
With a net force, there will be a change in momentum according to the momentum principle:
Since we are modeling the motion in python, I’m going to break the motion into short time intervals (Δt). During these intervals, I can assume that the force is constant (in this case, it’s actually constant) and use that to find the change in momentum. With the momentum, I can find the change in position. This is just your plain Euler method for numerical calculations. Using “1” for the beginning of the interval and “2” for the end, I get the following equations:
If you want more details, check out this tutorial.
OK, with that, here is my first ball model.