Magnetic pendulum
This simulation needs WebAssembly, and it could not start in this browser.
The image is a frame from a real run. Check that JavaScript is on, or try another browser.
A pendulum bob swings above three magnets at the corners of an equilateral triangle. Friction brings it to rest over one of them, and which one depends so delicately on the starting point that a map of the outcomes, with each start colored by its final magnet, has fractal boundaries. Near those boundaries the three colors interleave down to the finest scales.
What you see
The simulation follows one bob, released at rest from (Initial x₀, Initial y₀). Its trail is colored by the magnet currently nearest (red, green or blue), and it ends in a spiral around the magnet that captures it. To explore the basins, move the starting point by small amounts and compare where the bob ends up. The equations are integrated with fourth-order Runge-Kutta.
Classic fractal basins: the default values, , , , , magnets at radius 1 and a start at (0.9, 0.1).
Strong magnets: and . The magnets pull harder and their pull is more sharply peaked, so the bob is caught more abruptly.
Weak damping (long transient): , a quarter of the default. The bob keeps swinging between the magnets much longer before it is caught, and its trail becomes a dense tangle.
High pendulum (smooth basins): . From this height the three forces change more gently from place to place, and the basins have larger smooth regions.
Governing equation
where is the position of magnet , , and is the height of the bob above the magnet plane.
Parameters
δ (damping): the friction coefficient, 0.01 to 1. Larger values make the bob settle sooner; smaller values give longer, more complicated paths.
k (spring): a weak restoring force toward the center, standing in for gravity on a long pendulum, 0 to 1. At only the magnets act.
λ (magnet strength): the strength of the magnetic attraction, 0.1 to 5.
h (height above magnets): the height of the bob above the magnet plane, 0.1 to 3. It keeps the force finite directly above a magnet; larger values smooth out the differences between the magnets.
Magnet radius: the distance of each magnet from the center, 0.2 to 2.