Magnetic pendulum
An iron bob on a pendulum swings above a few magnets. It darts between them, circles, and finally comes to rest over one. Which one? Start it a hair's breadth away and the answer can change. Color every starting point by the magnet it ends at, and that sensitivity draws a fractal. Click or drag on the picture to let the bob go from there, and drag a magnet to move it. Each color on the map shows the magnet the bob comes to rest over when it starts from that point.
How it works
- Open this page and the bob is already swinging over the map. Its trail takes the color of the magnet it is nearest to.
- Click or drag anywhere to let it go from there. It always ends on the magnet whose color is under the point you chose.
- Drag a magnet, or change Friction or Magnet strength, and watch the map redraw itself. Set Map to 100% for the fractal alone, then save a PNG.
Three magnets, one pendulum
The bob hangs from a long string above a table with magnets on it. Gravity pulls it back toward the middle, each magnet pulls it toward itself, and the air slows it down. In the end it loses its energy and stops above one of the magnets. Seen from above, its path is a tangle of loops.
Where it starts decides where it ends
Each point on the map is a starting point, colored by the magnet the bob comes to rest over when it is let go there. Near the magnets the colors are calm and wide. Further out they fold into ever finer bands, and two neighboring start points can end at different magnets. That is chaos: fixed laws, yet an outcome you cannot predict without perfect precision.
Reading the map
The shading shows time: bright where the bob settles quickly, darker where it wanders longer. Friction sets how long the dance lasts, Height how sharply the magnets pull, and Gravity how hard the pendulum swings back to the middle. Less friction gives a finer, wilder map.
Frequently asked questions
Is the magnetic pendulum really chaotic?
Yes. Its motion follows fixed laws, yet tiny changes in the starting point grow until they decide the outcome. The fine bands on the map are where that happens.
Why does the bob always end on the color under its starting point?
The pendulum and the map use the same calculation with the same time step. Every pixel of the map is a full run of the pendulum from that point.
What do Height and Magnet strength do?
Height is how far the bob passes above the magnets. A lower bob feels a sharper, stronger pull close to each magnet. Magnet strength scales the pull of every magnet.
Why does the map take a moment to finish?
Each pixel needs a whole simulation, often hundreds of steps. The map first appears coarse and then sharpens. It is computed in the background, so the pendulum keeps swinging.
Does this upload anything?
No. The pendulum and the map are drawn on a canvas in your browser. Save downloads a PNG. Edit opens that image in the PictorX editor.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Go to Editor