Parameters
Click the canvas to launch the pendulum from any initial position. The basin is rendered by computing the final attractor for each grid point via RK4 integration.
Color-code each grid point by which magnet the pendulum eventually falls to, revealing a beautiful fractal basin of attraction. Experience how tiny differences in initial conditions lead to completely different outcomes.
Click the canvas to launch the pendulum from any initial position. The basin is rendered by computing the final attractor for each grid point via RK4 integration.
The motion is governed by Newton's second law, accounting for gravity, magnetic repulsion, and damping. The net force on the pendulum bob is the vector sum of all forces.
$$ m \frac{d^2 \vec{r}}{dt^2}= \vec{F}_g + \vec{F}_{damp}+ \sum_{i=1}^{3}\vec{F}_{magnet, i}$$Where:
$m$ is the bob's mass,
$\vec{r}$ is its position vector,
$\vec{F}_g$ is gravity ($mg$ downward),
$\vec{F}_{damp}$ is the damping force (proportional to $-b\vec{v}$, controlled by the Damping slider),
$\vec{F}_{magnet, i}$ is the repulsive force from the $i$-th magnet.
The magnetic force is modeled as an inverse-square repulsion from each magnet's fixed position. This is a simplified model that captures the essential chaotic dynamics.
$$ \vec{F}_{magnet, i}= \frac{k}{|\vec{r}- \vec{r}_i|^3}(\vec{r}- \vec{r}_i) $$Where:
$k$ is the magnetic strength constant (controlled by the Magnet Strength slider),
$\vec{r}_i$ is the fixed position of magnet $i$,
The denominator's cube comes from assuming a magnetic dipole repulsion. This force grows rapidly as the pendulum gets close to a magnet, creating the fierce competition that leads to chaos.
Secure Communication & Cryptography: The extreme sensitivity to initial conditions makes chaotic systems ideal for encrypting data. Small changes in the starting parameters (like magnet positions) generate completely different, unpredictable signals that can mask information, making it very hard to intercept and decode.
Fluid Mixing & Chemical Engineering: The intricate fractal boundaries seen in the basins are analogous to how fluids mix. Understanding this chaotic advection helps engineers design more efficient industrial mixers or reactors, ensuring two substances blend thoroughly and quickly.
Weather & Climate Modeling: The atmosphere is a chaotic system. Just like the pendulum's final magnet depends minutely on its start point, long-term weather predictions are inherently limited because we can never measure initial conditions (temperature, pressure, etc.) perfectly at every point on Earth.
Planetary Orbit Stability: The three-body problem in astrophysics (like a small asteroid moving under the gravity of the Sun and Jupiter) exhibits similar chaotic dynamics. Studying basins of attraction helps predict whether an orbit will be stable or ejected from the system over astronomical timescales.
When you start using this simulator, there are a few points you should be careful about. First is the misconception that "since a tiny change in the initial position leads to a drastically different result, the calculations must be ultra-precise". While sensitivity to initial conditions is indeed at the heart of chaos, the numerical errors in the simulation itself can be interpreted as "different initial values." Therefore, the choice of calculation method (RK4 in this tool's case) and time step (Δt) is critically important. For example, if you coarsen Δt from 0.01 seconds to 0.1 seconds, the visual trajectory can change completely, leading you to observe "chaos due to numerical error" rather than the intended "deterministic chaos." In practical engineering, there's a pitfall where making the mesh size or time step too coarse can generate non-physical oscillations.
Next is the balance of parameter settings. Making the damping coefficient γ close to zero allows energy conservation and can produce complex, beautiful trajectories. However, in real physical systems, damping from factors like air resistance always exists. Conversely, setting γ too high causes the pendulum to stop moving quickly, reducing the interesting chaotic behavior. For instance, in a system with mass m=1 and magnetic force k=1000, γ around 0.1 to 0.5 often provides a good balance between adequate damping and complex motion. In real-world CAE, setting a damper's damping coefficient to an unrealistic value is a classic example leading to simulation results that don't match actual test data.
Finally, don't assume "this simulation is perfectly realistic". The model for the magnetic force here is a simplified one that doesn't fully replicate the force between real magnetic dipoles. The parameter ε is also a "tweak" to stabilize the calculations. This approach is common in CAE, where complex phenomena are first approximated with easier-to-understand linear spring models. The first step is not perfect reproduction, but extracting the essence of the phenomenon.
Set damping=0.2, magnet count=3, magnet strength=1.2 T, pendulum length=0.5 m, magnet height=0.15 m. Release from offset 15° angle. Pendulum oscillates with decreasing amplitude (~15% energy loss per swing). Trajectory enters red basin and converges to lower-right magnet within 8–12 cycles. Adjacent release point (14.9°) may converge to different magnet, revealing fractal sensitivity characteristic of chaos.