# Chaotic Oscillating Magnetic Pendulum Simulation

Sensitivity to initial conditions is part of Chaos Theory. The basic premise is that very tiny changes to how a system starts can have very large changes as the system evolves. An interesting real world example showing sensitivity to initial conditions is an oscillating magnetic pendulum such as the ROMP which used to be sold by ThinkGeek.

If the pendulum begins to swing near one of the magnets it will be attracted to it and stop. Nothing very exciting or surprising with that result. The interesting results occur when the pendulum is outside the range of any single magnet. Once released the pendulum will chaotically jump between magnets until settling on one of them. In this scenario it becomes impossible to guess which magnet the pendulum will end up at. Even if you hold the pendulum starting point as accurate as possible between runs, a hairs width difference can result in a different final magnet being settled on.

Visions Of Chaos has simulated magnetic pendulums for some time now. The code behind the scenes is based on Mathew Tizard’s code here.

The following image is the result of simulating the magnetic pendulum setup with the pendulum swinging over 3 magnets. Each pixel of the image is the location the pendulum is “released” and starts to swing. The pixel color is determined by which of the 3 magnets the pendulum finally stops and settles on.

Click to enlarge to see the finer details. That image was rendered with 10x supersampling to bring out the finer details. 10x supersampling is equivalent to calculating the image at 100x the size and downsampling in an image editing application. Each pixel is the result of averaging the values of 100 resulting starting points.

Here are some more results from the simulation. They use different colors, different numbers of magnets and zoomed in images.

Here is a movie sample that shows the magnet’s field strengths being changed from 0 to 1.5 over the course of 600 frames.

Jason.