1
votes

https://www.youtube.com/watch?v=LkKhusT3PxM

Consider simulating balls colliding with each other in a box under gravity. The collisions will be inelastic : each time it happens, 1/2 of the kinetic energy is lost.

The naive strategy would be to predict which two balls collide next, and then integrate to that moment, do the collision, and repeat.

However, at first, perhaps on average it requires 1 seconds for a collision to happen. After a few collisions, the balls settle down a bit, and are packed closer, it only requires 1/2 seconds for a collision to happen. Soon it'll require only 1/4, 1/8, 1/16 seconds for a collision to occur.

My question is : This is like the Zeno paradox, 1 + 1/2 + 1/4 +.. will never exceed 2. And with constant CPU power, I'll never simulate the system past the 2-second mark.

How do people deal with these kinds of situations in a simulation?

1
Why would the required computing power be a function of how fast the balls are traveling? Wouldn't it only depend on how many balls are in your simulation? - Tim Biegeleisen
for example computing power can handle 100 collisions per millisecond. For example, in the first second, there'll be 100 collisions, taking 1ms. In the second second, there'll be 1000 collisions, taking 10ms, in the third second, there'll be 10000 collisions, taking 100ms to calculate. - seilgu
I think people have developed the idea of a resting contact for this reason. - John Alexiou

1 Answers

0
votes

Ultimately in real life all objects have a certain amount of energy, such as the ground state of an electron for example. Only objects at absolute zero have no energy, and it is a result of the Laws of Thermodynamics that no object or substance can be cooled to absolute zero in a finite number of steps (such as through inelastic collisions).

However, in Python (as with all programming languages) each number is stored by a certain number of binary digits (64-bits in this case). This means there is a smallest number that Python is capable of storing (What is the smallest number which can be represented in python?). According to this question it's roughly 5e-324. If the energy of a ball in your example ever fell below this value the program would store the energy as 0.0. This implies that eventually all balls in your system will have zero energy and thus will stop moving (I calculated that a ball with 1 to 10 units of energy will fall below this threshold after approximately 1100 collisions). From here it should be pretty clear at with a totally static system we can pass the 2 second mark. I hope this helps! Feel free to ask clarifying questions if I've explained something poorly.