🦋 Lorenz Attractor

The Lorenz system (Edward Lorenz, 1963) is a set of three coupled ordinary differential equations originally derived from a simplified atmospheric convection model. For classic parameters (σ=10, ρ=28, β=8/3) trajectories never repeat yet never leave a bounded region — a strange attractor. The iconic butterfly effect: two trajectories starting a distance 10⁻⁵ apart diverge exponentially, yet both trace the same wing-like shape. Drag to rotate. Multi-trajectory mode shows divergence in colour. 🇺🇦 Українська

Parameters

Trace

Points0
x
y
z
ρ≈28 → classic butterfly; ρ<24.74 → stable.

The Lorenz Equations

dx/dt = σ(y − x)    dy/dt = x(ρ − z) − y    dz/dt = xy − βz
Integrated with RK4 (dt ≈ 0.005). The two lobes of the attractor correspond to the two unstable equilibria at (±√(β(ρ−1)), ±√(β(ρ−1)), ρ−1). The Lyapunov exponent λ₁ ≈ 0.91 for classic parameters — trajectories separate at rate e^(0.91t).

About this simulation

This simulation numerically integrates the Lorenz system — dx/dt = σ(y − x), dy/dt = x(ρ − z) − y, dz/dt = xy − βz — using the fourth-order Runge–Kutta (RK4) method with a fixed step dt ≈ 0.005. Each frame advances the state several RK4 steps (set by Speed) and appends the new (x, y, z) point to a rolling buffer of up to 20,000 points rendered as a fading, colour-shifting 3D trail with Three.js. At the classic parameters σ=10, ρ=28, β=8/3 the trajectory never repeats and never settles, orbiting two unstable equilibrium points and tracing the famous two-lobed butterfly shape — a textbook strange attractor.

🔬 What it shows

A single point moving through 3D phase space under the Lorenz equations, its path drawn as a continuously growing trail. The two "wings" correspond to the two nontrivial fixed points at (±√(β(ρ−1)), ±√(β(ρ−1)), ρ−1); the trajectory loops around one, unpredictably switches to the other, and never closes on itself — the visual signature of deterministic chaos.

🎮 How to use it

Drag the canvas to rotate the view (OrbitControls with damping); use σ, ρ, and β sliders to reshape the attractor in real time. Speed sets how many RK4 steps run per animation frame. Reset restarts from (0.1, 0, 0); Autorotate toggles the slow automatic camera spin. The Info button opens a popup with the full equations and controls.

💡 Did you know?

Edward Lorenz found this system by accident in 1961 while re-running a weather model: printing an intermediate value as 0.506 instead of the full 0.506127 produced a wildly different forecast on re-entry. That rounding error revealed sensitive dependence on initial conditions — the origin of the term "butterfly effect."

Frequently asked questions

What do σ, ρ, and β actually represent?

They come from Lorenz's simplified atmospheric convection model: σ (Prandtl number) is the ratio of fluid viscosity to thermal conductivity, ρ (Rayleigh number) measures the applied temperature difference driving convection relative to the threshold needed for it to start, and β relates to the physical aspect ratio of the convecting layer. The "classic chaos" values used by default are σ=10, ρ=28, β=8/3, taken directly from Lorenz's original 1963 paper.

Why is this called a "strange attractor"?

An attractor is a set of states a system settles into over time; it is "strange" because it has a fractal (non-integer) dimension and the trajectory on it never repeats or self-intersects, yet stays confined to a bounded region forever. In this simulation you can see the trail wind around both lobes indefinitely without the path ever exactly retracing itself, which is the defining behaviour of a strange attractor.

How does this simulation demonstrate the butterfly effect?

The simulation integrates the same three coupled ODEs every frame with RK4 from a fixed starting point (0.1, 0, 0). Because the Lorenz system has a positive Lyapunov exponent (λ₁ ≈ 0.91 at the classic parameters), two trajectories that start an infinitesimal distance apart diverge exponentially, roughly as e^(0.91t) — doubling their separation every ≈0.76 time units — even though both remain confined to the same butterfly-shaped attractor.

Why integrate with RK4 instead of simple Euler steps?

The Lorenz system is chaotic and highly sensitive to numerical error, so a low-order method like Euler's would accumulate error quickly and distort the trajectory's long-term shape. Fourth-order Runge–Kutta cancels error terms up to O(dt⁴) per step, so with a tiny step size of dt ≈ 0.005 the simulated attractor closely matches the true continuous solution while remaining fast enough to run in real time in the browser.

What happens if I lower ρ below about 24.74?

At ρ ≈ 24.74 (for σ=10, β=8/3) the system undergoes a subcritical Hopf bifurcation. Below this threshold the two symmetric equilibrium points become stable, and instead of a chaotic butterfly the trajectory spirals inward and settles onto one of them — no more chaos, no more attractor, just simple convergence. Above it, the equilibria are unstable and trajectories are repelled onto the strange attractor instead.