Magnetic Pendulum Fractal illustration

Magnetic Pendulum Fractal

A metal pendulum swings over three (or more) magnets and, after a chaotic dance, comes to rest above one of them. Which magnet wins depends so sensitively on where the pendulum starts that the answer forms a fractal. This tool has two modes. Release the pendulum by clicking anywhere and watch a single trajectory loop and settle in real time, or render the basins of attraction: every starting point in the plane is coloured by the magnet it ends on, drawing intricate interwoven boundaries. Move the magnets, change their strength, gravity and friction, and the fractal basins redraw.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • Each magnet pulls the bob with an inverse-square force while gravity pulls it toward centre and friction bleeds off energy, so the pendulum eventually stops over one magnet — but which one is hard to predict.
  • The basin boundaries are fractal: near them, two start points a hair apart end on different magnets, so no amount of zooming ever gives a smooth border.
  • This is a deterministic system with no randomness anywhere — the same start always gives the same magnet — yet the outcome map is endlessly intricate, a hallmark of deterministic chaos.
  • Runs 100% in your browser — simulations are computed locally on your device.