A magnetic pendulum is a classic chaotic dynamical system: a bob swinging above several fixed magnets is pulled toward whichever one it passes closest to, and microscopic differences in the starting position lead to wildly different final resting magnets, producing fractal basin-of-attraction boundaries. This simulation approximates the bob's horizontal (x,z) offset as a damped 2D oscillator, integrating a spring restoring force plus an inverse-square attraction from each magnet using a fixed-step sub-stepped Euler scheme (6 substeps per frame) for numerical stability. Every frame the bob's position is pushed into a ring-buffer point trail, colored by the nearest magnet, so the chaotic path and its basin structure become visible over time.