x:  y:  z:  Speed:  Points: 0  σ=10  ρ=28  β=2.67

About the Lorenz Attractor — 3D Chaos Simulation

The Lorenz system is a set of three coupled nonlinear ordinary differential equations first derived by meteorologist Edward Lorenz in 1963 while modelling atmospheric convection: ẍ = σ(y − x), ẏ = x(ρ − z) − y, ż = xy − βz. For the classical parameters σ = 10, ρ = 28, β = 8/3, the trajectory never closes on itself but stays forever confined to a bounded, fractal region of phase space — the Lorenz strange attractor. The system is the prototypical example of deterministic chaos: tiny differences in starting conditions grow exponentially, making long-term prediction impossible despite fully deterministic equations.

This simulation integrates the Lorenz equations in real time using the fourth-order Runge–Kutta method (step dt = 0.005) inside a Three.js WebGL scene with free-orbit camera (OrbitControls). Each point on the ribbon trail is coloured by one of four modes — instantaneous speed, current wing (x < 0 or x > 0), height along the z-axis, or elapsed time — making the topology of the strange attractor visually vivid. Five presets let you explore qualitative changes of behaviour: classic chaos at ρ = 28, near-bifurcation at ρ = 24, a genuinely periodic orbit at ρ = 99.96, transient chaos before settling at ρ = 21, and the simplified Lorenz-84 atmospheric model.

Frequently Asked Questions

What are the Lorenz equations?

The Lorenz equations are three coupled first-order ODEs: d x/dt = σ(y − x), d y/dt = x(ρ − z) − y, d z/dt = xy − βz. They model the convection rolls of a thin fluid layer heated from below (Rayleigh-Bénard convection). The variable x is proportional to the rate of convective overturning, y to the horizontal temperature difference, and z to the distortion of the vertical temperature profile. Lorenz derived them in 1963 from the Navier–Stokes equations by retaining only three Fourier modes.

How do I control this simulation?

Drag on the 3D canvas to orbit the attractor; scroll or pinch to zoom; right-click-drag to pan. The HUD sliders at the top let you change σ (sigma), ρ (rho), and β (beta) in real time, and the Trail slider adjusts how many recent integration steps are shown. The Colour dropdown switches between colouring by speed, wing side, height, or time. The Preset menu instantly applies five well-known parameter sets. Pause / Play stops and resumes integration; Reset restarts from the origin and recentres the camera.

Why is the Lorenz attractor called a “butterfly”?

When viewed from above (along the z-axis) the two looping orbits of the Lorenz attractor resemble the wings of a butterfly, with the trajectory spiralling outward on one lobe and then switching to spiral outward on the other. This visual shape lent its name to the “butterfly effect” — Lorenz popularised the metaphor in a 1972 lecture titled “Predictability: Does the Flap of a Butterfly’s Wings in Brazil Set Off a Tornado in Texas?” to describe how small perturbations amplify exponentially in chaotic systems.

What integration method does this simulation use?

The simulation uses the classic fourth-order Runge–Kutta (RK4) method with a fixed time step of dt = 0.005 and 6 sub-steps per rendered frame (effective advance 0.03 per frame at 60 fps). RK4 provides fourth-order accuracy — local truncation error O(dt⁵) — which is important for a stiff chaotic system like the Lorenz attractor where a simpler Euler method accumulates phase-space errors quickly. The trajectory therefore closely tracks the true mathematical attractor for thousands of steps before chaotic divergence from any “true” orbit becomes inevitable.

What is a strange attractor?

A strange attractor is an attractor in phase space that has a fractal structure — it occupies zero volume yet trajectories remain confined to it for all time. The Lorenz attractor has a Hausdorff (fractal) dimension of approximately 2.06, meaning it is slightly more complex than a surface but far less space-filling than a 3D solid. Nearby trajectories on the attractor diverge at an average rate measured by the maximum Lyapunov exponent λ₁ ≈ 0.906 s‏⁻¹, confirming deterministic chaos: predictability halves roughly every 0.76 time units (≈ln 2 / λ₁).

What happens when rho (ρ) is changed?

The parameter ρ controls the driving force (analogous to the Rayleigh number in convection). For ρ < 1 all trajectories converge to the origin (no convection). For 1 < ρ < 24.74 the system has two stable fixed points (steady convection rolls). At ρ ≈ 24.74 a subcritical Hopf bifurcation occurs and chaos emerges. At ρ = 28 the famous strange attractor exists. Near ρ = 99.96 a periodic orbit reappears — sometimes called a periodic window inside the chaotic regime. The Preset menu lets you jump between these qualitatively distinct behaviours without manual tuning.

What do sigma (σ) and beta (β) control?

σ is the Prandtl number, the ratio of momentum diffusivity (kinematic viscosity) to thermal diffusivity. For air σ ≈ 0.72; Lorenz used σ = 10 which suits water and gives robust chaos. Reducing σ below 1 tends to suppress chaos. β is a geometric factor related to the aspect ratio of the convection cell: for the classical circular roll approximation β = 8/3 ≈ 2.667. Changing β shifts the positions of the fixed-point wings and alters the fractal dimension of the attractor slightly but rarely eliminates chaos for standard ρ=28.

How is colouring by speed calculated?

At each integration step the instantaneous speed is computed as the magnitude of the phase-space velocity vector: |v| = √(ẍ² + ẏ² + ż²). This is mapped linearly from the range 0–30 to a hue value 240°–0° (blue for slow, red for fast). The trail therefore typically shows blue (slow) near the inner spirals of each lobe — where the trajectory winds tightly — and red (fast) near the cross-over saddle region between the two wings, making the dynamical structure immediately visible.

Why does the trail use a circular buffer?

A circular (ring) buffer of length equal to the trail slider value stores only the most recent N integration points. When the buffer is full, each new point overwrites the oldest, so memory usage is constant regardless of how long the simulation runs. The Three.js geometry is rebuilt every frame by reading the buffer in chronological order and uploading the resulting ordered float arrays to the GPU via BufferAttribute. This approach avoids unbounded memory growth while keeping the trail exactly the requested length.

Is the Lorenz attractor truly three-dimensional?

Yes. Each orbit lives in the three-dimensional phase space (x, y, z). The attractor itself is an infinitely thin set with fractal dimension ≈ 2.06 — it is essentially a folded two-dimensional surface, folded infinitely often like a pastry. In two dimensions you would only see a projection: the classic side view shows two linked spirals, the top view shows the butterfly wings. This simulation lets you orbit freely to appreciate the genuine 3D geometry, including the spiralling helices of each lobe and the narrow bridge connecting them.

What are common misconceptions about the butterfly effect?

The butterfly effect is often misunderstood as meaning that a butterfly literally causes a tornado. What it actually states is that in a chaotic system a small change in initial conditions leads to exponentially diverging outcomes over time — making long-range prediction fundamentally limited, not that the butterfly is the actual physical cause. A second common misconception is that chaos means randomness. The Lorenz system is entirely deterministic: given identical starting conditions the trajectory is identical every time. Apparent randomness arises from the exponential sensitivity to the tiny imprecision inherent in any real measurement.