Member-only story
Modeling Collisions in Python: From Elastic to Inelastic to Plain
In your introductory physics course, there are three types of collisions. The simplest (from a physics perspective) is the inelasitc collision in which two objects impact and then stick together. The next kind is the elastic collision. This is a “bouncy” collision. Finally, there is a collision that is in between the elastic and inelastic. I’m just going to call these “plain” collisions.
How do you model these three types of collisions in python? It’s not too difficult, but there are some tricks that I need to show you to get it working.
The Physics of Collisions
Before getting to numerical models, let’s just go over the very basic physics stuff for collisions. Imagine I have two balls (I will call them A and B) that collide. During this collision, there is a force that ball A exerts on ball B. However, Newton’s 3rd law says that forces come in pairs. So, if A pushes on B then B pushes back on A with the same magnitude (but in the opposite direction).
If that’s the only force on each of the balls, then the momentum principle says the following:
Where we define the momentum (p) as the product of mass (m) and velocity (v). Since the time interval for the collision is the same for both balls — the change in momentum…
