Magnetic Bunimovic billiard with 200 million balls

Balls moving in a Bunimovic billiard with and without a magnetic field. The Lorentz force forces the balls to move in circular trajectories. However, if hitting the billiard domain boundary the balls skip along the boundary. The magnetic field renders a more localised behaviour compared to the same initial conditions without a magnetic field, i.e., less chaos in an otherwise chaotic billiard. This despite the initial condition had a three times larger spread in velocities in the magnetic field configuration. Final rendering took approx 12 hours on my MB Pro M3 MAX 64 GB. The cool song was made (today) by @gpcbass - it's called Alhambra, named after the eighth wonder of the world, which we visited just a week ago!. Visuals in Python, PyTorch (using MPS) and Matplotlib/Nilearn. Frames stitched by FFmpeg.