Magnetic Pendulum Chaos (2D)

A magnetic pendulum swings above three fixed magnets and gets pulled toward whichever one it passes closest to. This top-down 2D port integrates the exact same planar model as the 3D version: a damped spring restoring force toward the pivot's rest point plus inverse-square attraction from each magnet, sub-stepped (6x per frame) with Euler integration for stability. Tiny differences in the starting position lead to wildly different final magnets — the fractal basin-of-attraction signature of chaos.

Magnets
3 (triangular)
Integration
Sub-stepped Euler (6x)
Damping
0.35
Spring constant
0.9
Trail points
2000 max
1.0
0.35
1.0
Magnet A Magnet B Magnet C