These 3D pictures (except the last) were generated by a Python + Vpython program, translated from Paul Bourke’s C program (which has a bunch more pretty pictures). See below for code.

The **Lorenz system** is a system of ordinary differential equations (the **Lorenz equations**) first studied by Edward Lorenz. It is notable for having chaotic solutions for certain parameter values and initial conditions. In particular, the Lorenz attractor is a set of chaotic solutions of the Lorenz system which, when plotted, resemble a butterfly or figure eight. (wikipedia)

According to Paul Bourke:

The Lorenz attractor was first studied by Ed N. Lorenz, a meterologist, around 1963. It was derived from a simplified model of convection in the earths atmosphere. It also arises naturally in models of lasers and dynamos. The system is most commonly expressed as 3 coupled non-linear differential equations.

dx / dt = a (y – x)dy / dt = x (b – z) – y
dz / dt = xy – c z

One commonly used set of constants is a = 10, b = 28, c = 8 / 3. Another is a = 28, b = 46.92, c = 4. “a” is sometimes known as the **Prandtl** number and “b” the **Rayleigh** number.

The series does not form limit cycles nor does it ever reach a steady state. Instead it is an example of deterministic chaos. As with other chaotic systems the Lorenz system is sensitive to the initial conditions, two initial states no matter how close will diverge, usually sooner rather than later.

# http://fractalart.gallery/lorenz-attractor/
# based on http://paulbourke.net/fractals/lorenz/
from visual import *
import numpy
title="Lorentz Attractor"
width,height=1200,1200
d=display(title=title,width=width,height=height)
d.autocenter=True
hui=.00005 # hue increment
dmaxx=1.90274198766 # get this from print dmax
N=150
h = 0.004
a = 10.0; b = 28.0; c = 8.0 / 3.0;
#a = 28; b = 46.92; c = 4.
x0 = 0.1;
y0 = 0.0
z0 = 0.0
H=S=V=0
dmax=0
skip=0
for i in range(N):
line = curve( pos=(x0,y0,z0), color = color.hsv_to_rgb((H,S,V)),radius=0.2)
for j in range(N):
x1 = x0 + h * a * (y0 - x0);
y1 = y0 + h * (x0 * (b - z0) - y0);
z1 = z0 + h * (x0 * y0 - c * z0);
dist = sqrt((x1-x0)**2 + (y1-y0)**2 + (z1-z0)**2)
if dist>dmax: dmax=dist
x0 = x1;
y0 = y1;
z0 = z1;
if skip>100:
H=dist/dmaxx
S=V=1
# line.append( pos=(x0,y0,z0),color=color.hsv_to_rgb((H,S,V)))
sphere(pos=(x0,y0,z0),color=color.hsv_to_rgb((H,S,V)),radius=0.4)
skip+=1
print(dmax)

### Like this:

Like Loading...

*Related*

## One thought on “Lorenz Attractor”