Newton's Cradle Animation

The purpose of this project is to animate Newton’s Cradle from first principles. Newton’s Cradle has been animated before however typically via a key-frame method or one reliant on a complicated physics engine. In this post we will animate Newton’s Cradle by implementing our own minimalist physics engine. We will use the following guiding statement to develop our simulator;

“Newton’s Cradle can be modelled as multiple pendulums confined to swing along a single axis which undergo elastic collisions with one another. The pendulums rest such that there is a small amount of horizontal displacement between their masses.’’

Here a pendulum means a mass attached to a massless, rigid, fixed-length with an angle to the vertical which obeys differential equation

Here “elastic” means the collisions occur conserving energy and momentum.

For a more precise mathematical description please see this white paper.

The Runge–Kutta numerical integration technique was used.

The code used to produce the following animations can be found here. However, this pseudocode gives an idea of the general approach;

for t in time_interval:
    cradle.CheckForCollisions()
    
    for pendulum in cradle.pendulums:
        pendulum.IntegrateStep(t)
    
    cradle.plot()

middle pendulum motion

Watching these animations closely, we notice that the once stationary middle masses begin to move after some time. The same phenomena can be seen in this video of a real cradle. This is a remarkable result.

The explanation for this originates from what we meant by the separation between pendulums being small.

With our simulated system we can place the pendulums closer together. Observe how this increases the time before the motion of the internal masses becomes obvious.

Original separation between pendulums

1/100th of original separation between pendulums

We could continue placing the masses closer and closer together, yet this comes at the cost of computation time. I thought this was an interesting observation.

non-equal masses

The code used to produce the following animations can be found here.

In this animation we require that each mass has the same density, meaning the larger radii on the right has a larger mass.

extra animations