Bouncing Balls with Python: From Boring to Back Spin

Rhett Allain
7 min readSep 18, 2023
Image: Rhett Allain. Bouncing ball model in python.

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…

--

--

Rhett Allain
Rhett Allain

Written by Rhett Allain

Physics faculty, science blogger of all things geek. Technical Consultant for CBS MacGyver and MythBusters. WIRED blogger.

Responses (2)