Lorenz Attractor with Grasshopper Python
In 1963, meteorologist and mathematician Edward Lorenz modelled the thermally driven motion of atmospheric air currents. He used the set of chaotic solutions to a system of nonlinear differential equations, called the Lorenz attractor. Known for its butterfly-wing geometry when plotted in three-dimensional space, it is one of the most famous examples of deterministic chaos. I finally managed to spend 3 hours from my life for this model, which had been sitting on my to-do list for a long time.

System of Equations
The system is defined with three variables (x, y, z) and three positive parameters (sigma, rho, beta) as follows:

This system is said to have three key properties.
- Strange attractor: Trajectories are drawn over time into a bounded region, yet they never repeat themselves exactly and never intersect. It has a fractal geometry.
- Sensitivity to initial conditions: A tiny difference in initial values grows exponentially over time. This shows that even in a deterministic system (with no randomness), long-term prediction is practically impossible (the butterfly effect).
- Two unstable equilibrium points: The two “wings” of the attractor orbit around two unstable equilibrium points of the system; the trajectory circles one wing for a while before jumping to the other.
Grasshopper 2.0 Model
Deciding that there would be loops while trying to model it, I chose to use Python. Yes, loops can be done in Grasshopper too, and maybe it can be modeled more explicitly there later on. Here is the real beauty of it: unlike a standard function curve, there is no closed-form analytical formula that can give me the (x, y, z) coordinate at a given time t. Since the solution to the Lorenz system cannot be written in closed form, the point position at time t is found iteratively from the previous point. Therefore, you need to use a dt value and a domain. I thought it could be a nice exercise to try getting used to Grasshopper 2.0. They made the interface much busier/more playful than Grasshopper 1.0—honestly, I couldn’t decide whether that’s good or bad. Even though it wasn’t strictly necessary, I used the Python 3 component. The same code will work the same way with Python 3 in Grasshopper 1.0 as well. You can see the code below. Anyone who knows while loops will notice that if you give a decreasing interval (like 50 To 1), the while loop will probably blow up. By the way, I’m still struggling to get used to Grasshopper 2.0. Still, it was impressive how it calculated and displayed 5,000 points all at once without any struggle.
from Rhino.Geometry import Point3d
t_start = domain[0]
t_end = domain[1]
t_gap = t_end - t_start
dt = t_gap / nr_of_points
t = t_start
x = origin_point[0]
y = origin_point[1]
z = origin_point[2]
P = []
while t < t_end:
xn = sigma * (y - x) * dt
yn = (x * (rho - z) - y) * dt
zn = (x * y - beta * z) * dt
x = x + xn
y = y + yn
z = z + zn
P.append(Point3d(x,y,z))
t = t + dt

Edward Lorenz’s Butterfly
Lorenz (1917–2008), who worked at MIT for many years, was trying to understand why weather forecasts became unpredictable after a certain point in a calculation. This is considered an important milestone in modern scientific thought. While trying to model atmospheric flows, he noticed that a very small change in an input soon caused the path to diverge completely, and the paper he wrote introduced the equations above. As a result, he showed how the Newtonian approach (“if you know the initial conditions, you can calculate the future”) can break down in certain systems. Lorenz initially used the seagull metaphor. Later, in a 1972 presentation, he illustrated this phenomenon with the famous “Butterfly Effect.” It has been known as the butterfly effect ever since. In everyday language, chaos sometimes gets mixed up with randomness. Yet in chaos, just as in deterministic systems, the rules are fixed. The only difference is that in chaos the trajectory cannot be predicted, meaning there is no lawlessness or randomness, only a limit to predictability. In fact, as designers, we might benefit from being a bit more careful when using the term chaos. We can’t call every system that is unpredictable and looks random, yet has rules behind it, as chaotic.






