Three Magnets Pendulum

3 magnets pendulum photo


The image above shows a three magnets pendulum that I set up at home. Three 24 mm diameter magnets sit at the bottom. Their magnetic fields attract the pendulum bob, which hang from a string about half a meter long. The pendulum gradually looses energy to friction and slows down, eventually coming to a stop above one of the three magnets.

So what makes the three magnets pendulum special? Well, most importantly it does chaos. With that I mean that every run looks different due to extreme sensitivity to small differences in starting position. This sensitivity makes it almost impossible to predict over which magnet the pendulum bob will stop. The video below shows a typical example of this behavior.

The Simulation Model

I had seen simulations of the three magnet pendulum online before, but found myself wanting to see more detailed results. For this I had to expand on the results myself, and I will come back to that in a follow-up blog post. Here I will go through the model concept that I chose to work with.

There are quite a few simulations of this arrangement available, all similar in model and results. For my investigation I chose to adopt one of the earlier models I found online, by Ingo Berg, available here. The basic principle of calculating and tracing the pendulum bob is completely in line with what I explain in a previous post. It’s all about position, velocity and acceleration due to forces.

It is the three magnetic forces acting on the pendulum that makes this system interesting. These are simplified in the model, and the absolute accuracy can be discussed, but my interest here has more to do with the principle. The simulation results are shown in the video below, where each magnet is represented by a color. Upper left magnet is green, upper right is red, and lower mid is blue.

The video shows the pendulum bob tracing paths through the horizontal plane above the magnets. The starting position of each trace takes the color of the magnet it stops at. This process creates a colorful “map” seen at the end of the video.

Some Simulation Details

As for my boids simulations, I use CUDA with a GeForce 1050 (640 cores) graphics card to simulate multiple pendulum paths simultaneously. This is necessary to finish enough 1280×720 pixels frames to make a video within a reasonable waiting time. Ingo Berg mentions in his text that a single 1000×1000 pixels image took 4-5 hours on a single core processor (back in 2006). Using CUDA each 1280×720 pixels image took about a minute. I have no doubt my code could be optimized further, but it is good enough for me, for now.

Three Magnets Pendulum Results Discussion

The simulated image at the end of the video is displayed below. The somewhat psychedelic pattern is an example of a basin of attraction. It is also fractal in nature. We will leave the mathematical subtleties aside though, and state the simplest interpretation. Namely: starting the pendulum bob over a pixel of certain color leads to the bob ending up above the magnet of corresponding color.

3 magnets basin

Seeing this smeared out patches of color woke my interest. What happens within the finer details, and at boundaries between colors? Is it a self-similar fractal, with repeating patterns at “deeper” levels? This will be the topic of a follow-up blog post.

Leave a Reply

Close Menu