Most of my teaching is in the semester whose teaching weeks ended yesterday — it has been a bit crazy. I was more-or-less completely revising two of the three courses I was teaching, so I was a like a little hamster perpetually running on a hamster wheel of lecture and question sheet writing.

But that has now finished. However, I now have to revise bits of the computational course I run in the second semester. A colleague is teaching a new mechanics module, so we need a new computational project or two.

I had a look around, and came across the Gaspard-Rice model, which looks quite entertaining. It consists of three fixed discs, shown in grey above, that are arranged in a triangle. A particle is then fired in from the left – the starting point is shown as small black circle. The particle then elastically collides with any disc it encounters. Two trajectories, both of which start from the point shown in black, are shown.

If the particle’s trajectory is perfectly horizontal, it heads right, hits the rightmost disc absolutely head on and bounces back, retracing its steps and ending up leaving the field of view at the left.

But if the trajectory deviates even a little above or below the horizontal then the particle bounces up or down after the first collision with the rightmost disc and then it can hit the top and bottom discs on the way out. A slightly higher or lower trajectory can even result in the particle exiting top right not to the left. This is shown in the red trajectory.

What happens to the particle, in the sense of which of the three gaps it ends up taking to escape and how many times it collides before it does this, is very sensitive to the exact initial trajectory. This sensitivity of the dynamics to very small changes in the initial velocity, means the dynamics are what is called chaotic. Chaotic dynamics are by definition very sensitive to small changes in the initial conditions.

This makes them fun to study. The diagram above was produce by 100 lines of code, plus a random number generator (for the initial velocity) and it is an easy 100 lines. The original Gaspard-Rice model uses perfectly rigid discs, and so the dynamics rely on coding reflections which I think some students would struggle with. So I replaced them with discs with a very stiff repulsion for the particle, which means the dynamics can be just be coded with simple differential equations. So, I think students should be able to get it working, and then play around with the chaotic trajectories.