Feeds:
Posts

## Lorenz Attractor

I was looking at the book ” the Computational Beauty by nature ” and I saw the Lorenz Attractor Function. The Lorenz attractor, named for Edward N. Lorenz, is a 3-dimensional structure corresponding to the long-term behavior of a chaotic flow, noted for its lemniscate shape. The map shows how the state of a dynamical system (the three variables of a three-dimensional system) evolves over time in a complex, non-repeating pattern. this is a three dimensional Picture and you might need to put on your anaglyph glasses to see it as it is in space.

you can also find the script in Marc Fornez’s blog, Feb 23, 2006. I changed it a little and here is the result with the vector presenting the directions of the flow.

Option Explicit

Call Lorenz attractor()
Sub Lorenz attractor()
Dim x,y,z
Dim arrpt2
x=1: y=1: z=1
Dim arrpt1: arrpt1=array(x,y,z)
Dim min: min=1
Dim max: max=200000
Dim h : h=0.01

Do While (min<=max)
x=x+h*dx(x,y,z)
y=y+h*dy(x,y,z)
z=z+h*dz(x,y,z)
arrpt2=array(x,y,z)

‘Call rhino.ObjectColor(ptstr,ParamColor(x))
Dim vecdir: vecdir=rhino.vectorcreate(arrpt1, arrpt2)

arrpt1=arrpt2
min=min+1
Loop

‘Call Rhino.EnableRedraw(True)
End Sub

Function dx(x,y,z)
‘rho = 28; sigma = 10; beta = 8/3
dx= 10*(y – x)

End Function

Function dy(x,y,z)
‘rho = 28; sigma = 10; beta = 8/3
dy= x*(28 – z) – y

End Function
Function dz(x,y,z)
‘rho = 28; sigma = 10; beta = 8/3
dz= x*y – 8/3*z
End Function