Lorenz Strange Attractor
In this project I explore the Lorenz Strange Attractor in 3D using ThreeJS. The Lorenz Attractor is a dynamical system that exhibits chaotic behavior and is named after Edward Lorenz who discovered it in 1963 while studying weather patterns.
Open demoThe Equations Behind the Attractor
The Lorenz Attractor comes from a set of three equations created by Edward Lorenz in 1963. He was trying to simplify how air moves in the atmosphere— specifically how warm and cool air create circular convection currents. What's surprising is that even though these equations are short, they behave in incredibly unpredictable ways. Here are the original equations:
These equations describe how three values
To simulate the system on a computer, we don't solve the equations all at once. Instead, we break time into small steps and update the values over and over. This is called numerical integration. A simple way to do it is to rewrite the equations like this:
Whether we use the continuous version or the step-by-step one, the idea is the same. The variables
- (sigma) controls how fast the air moves compared to how fast heat spreads. It's like comparing how quickly water stirs versus how quickly it heats up.
- (rho) relates to how strongly the system is heated. When this value gets big enough, things become unstable and interesting patterns emerge.
- (beta) is a damping factor. It determines how fast the motion dies down, kind of like how thick honey resists movement more than water.
In his original paper, called Deterministic Nonperiodic Flow, Lorenz used:
If you run the simulation using those values, the path traced out in 3D looks like a pair of wings. This is the famous "butterfly" shape that gave rise to the phrase "the butterfly effect". Note that this pattern never exactly repeats itself, even if you let it run forever. But it also never flies off to infinity—it stays within a defined shape. That's what we call a "strange attractor", it attracts the motion into a shape, but the motion inside that shape is endlessly complex.
Closing Thoughts
The Lorenz Attractor is a classic example of how simple equations can create complex behavior. You don't need randomness to get unpredictability. If you're curious about math, physics, or just like visualizing beautiful things that come from code, I definitely recommend experimenting with the demo, trying out different parameters, and seeing how the attractor changes. It's a great way to explore the boundary between order and chaos, and to appreciate how even simple rules can lead to incredibly intricate patterns.