designcoding
About Table of Contents Keywords Monthly Archive
Support designcoding!

Lorenz Attractor with Grasshopper Python

November 26, 2026 | Algorithms
#attractor #chaos #fractal #grasshopper #rhino-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.

Lorenz Attractor with Grasshopper Python animation

System of Equations

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

Lorenz Attractor with Grasshopper Python attractor, chaos

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
Lorenz Attractor with Grasshopper Python Grasshopper definition

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.

Lorenz Attractor with Grasshopper Python fractal, grasshopper
Grasshopper 2.0 definition (GHZ)Download

Cite this post

Yazar, T. (2026, November 26). Lorenz Attractor with Grasshopper Python. designcoding. Retrieved November 26, 2026, from https://www.designcoding.net/lorenz-attractor-with-grasshopper-python/

Related Posts

Mandelbrot Set

October 10, 2012

Today’s fractal is the famous Mandelbrot Set. The Mandelbrot set is a well-known and complex mathematical set often associated with fractals and chaos theory. Named after the mathematician Benoît B. Mandelbrot, it’s a set of complex numbers defined by a simple iterative process. The Mandelbrot set is an intricate and self-similar boundary, which reveals increasingly complex patterns at different magnifications. On the other hand, I heard the term “The fingerprint of God” in some sources resembling its aesthetic and philosophical…

Julia Set

October 10, 2012

Today’s fractal is the Julia Set, the amazing simplicity of chaos. There are lots of applets and articles on the internet about this fractal. You can generate this with the iteration of a basic function many times and placing points on the complex plane. I developed a Grasshopper implementation in 2012. Also, this was my first study on complex numbers. At each iteration, the detail level increases. I utilized a common brute-force approach, distributing a grid of points, converting them…

Hilbert Curve

January 16, 2024

The Hilbert Curve, also referred to as the Hilbert space-filling curve, was initially introduced by the German mathematician David Hilbert in 1891. It is a continuous fractal curve, presenting a variation of the space-filling Peano curves uncovered by Giuseppe Peano in 1890. After a study on the mathematical background of this curve, I implemented a Python code into Grasshopper Python. However, I wanted to explore more variations by playing with the algorithm. This is why, the resulting Grasshopper definition can…

Polygon Fractals with Rhino Python

August 2, 2017

We will see a simple Rhino Python exercise here. I called these Polygon Fractals (or Pentaflakes sometimes). It is both educational and fun to play with them. In Rhino, it can be a good exercise for basic CAD commands and transformations such as move, copy, and scale, and precision drawing operations such as object snapping. Also, in Grasshopper, it can be a good challenge for looping. In Rhino Python, it is already a good exercise for understanding Python and the…

Fractal Curves with Rhino Python

July 31, 2017

A simple Rhino Python script that generates fractal curves. An example is a test with the Gosper-Peano curve. However the script is not supporting segment directions, which is why the result is not the intended curve. Curve directions could be implemented in the future.

  • Chapters

    • Algorithms
    • Discourses
    • Escapes
    • Fabrications
    • Studios
  • Explore

    • Table of Contents
    • Monthly Archive

    • All Keywords
    • #pattern
    • #polyhedra
    • #design-education
    • #interlocking
    • #kuka-prc
    • #robot
    • #parakeet
    • #sphere
    • #parametric-surface
    • #terrain
    • #3d-printing
    • #polygon
    • #lace
    • #facade
    • #wave
    • #frege
    • #gauss
    • #voronoi
    • #laser-cutting
    • #fibonacci
  • Search

  • Support designcoding!

  • Enjoying designcoding? Support me on Patreon to keep it growing. Thank you!

  • copyright 2026 designcoding.net | about | privacy policy | end user license agreement