# lorenz3D

No preview image

### 1 collaborator Uri Wilensky (Author)

### Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3D Preview 4 • Viewed 162 times • Downloaded 21 times • Run 0 times Download this modelEmbed this model

### WHAT IS IT?

The Lorenz system is a well known example of a simple system showing chaos. Its dynamics depend on many parameters. Here named a b c mu gamma and deltat and the initial conditions x0 y0 z0.

### HOW IT WORKS

We calculate the values of k points x, y, and z (k = 2000) iterating the 3 main equations:

x(n)= x(n - 1) + gamma * y(n - 1) - x(n - 1) * deltat

y(n)= y(n - 1) + ( - (x(n - 1) * z(n - 1)) + mu * x(n - 1) - (y(n - 1)) * deltat)

z(n)= z(n - 1) + ((x(n - 1) * y(n - 1) - b * z(n - 1) * deltat

Initial points are x(0)=x0, y(0)=y0 and z(0)=z0 This give the trajectory.

### HOW TO USE IT

deltat slider: sets deltat between 0.0010 and 0.015

SETUP: Clears all the parameter and start again the the 3D graphic window.

GO: Build the trajectory for the choosen values.

BallColor slider: sets foundamental color of the points.

BallSize slider: sets the size of points between 0.03 to 2

SameColor switch: "On" gradually changes the color of points otherways the color is fixed.

Screen slider: virtually sets the edge of 3D.

### THINGS TO TRY

Identify the attractor for different values of "deltat".

Try to lok at different representation in the XY, XZ, YZ and Zt (where t is time) spaces. Especially the last one, if compared with the 3D graph, can be interesting for the novice.

### CREDITS AND REFERENCES

Program by Massimo Salzano, www.ecople.org, http://www.dise.unisa.it/docenti/salzano.htm

14 May 2005.

## Comments and Questions

Click to Run Model

```globals [a b c mu gamma x0 y0 z0 k n x y z SC]
breed [ tails ]
breed [ balls ]
breed [ valu ]

balls-own [ z-vel x-vel y-vel ]
turtles-own [ col ]

to setup
ca

create-balls 1
[
set shape "circle"
set color 45 set size BallSize
]
setxyz -10 -17 20
face patch 0 0 0

set n 1 set a .28 set b 2.11 set c 4.07 set k 2000
set mu 27.56 set gamma 9
end

to go
let speed 0
ask balls [set x-vel [] set y-vel [] set z-vel[]
set x0 1 set y0 1 set z0 1
set x-vel lput x0 x-vel set y-vel lput y0 y-vel set z-vel lput z0 z-vel
set shape "circle"
]

while [n < k][ask balls[
set x-vel lput ((item (n - 1) x-vel) + gamma * ((item (n - 1) y-vel) - (item (n - 1) x-vel)) * deltat ) x-vel
set y-vel lput (((item (n - 1) y-vel)) + ((( - (item (n - 1) x-vel)) * (item (n - 1) z-vel)) + mu * (item (n - 1) x-vel) - (item (n - 1) y-vel)) * deltat) y-vel
set z-vel lput ((item (n - 1) z-vel) + ((item (n - 1) x-vel) * (item (n - 1) y-vel) - b * (item (n - 1) z-vel)) * deltat) z-vel
set xcor ((item (n - 1) x-vel) / (screen / 2)) set ycor ((item (n - 1) y-vel) / (screen / 2)) set zcor ((item (n - 1) z-vel) / (screen / 2)) - (screen * 1.5)
set x item (n - 1) x-vel set y item (n - 1) y-vel set z item (n - 1) z-vel
if (Same_Color = false) [set SC (n / 150)]
set color (BallColor + SC)
plot1 plot2 plot3 plotz
set speed sqrt( item (n - 1) x-vel * item (n - 1) x-vel + item (n - 1) y-vel * item (n - 1) y-vel + item (n - 1) z-vel * item (n - 1) z-vel )
if tails? and speed > 0.03
[
hatch-tails 2
[ set col color ]
]
]set n n + 1 ]
end

to plot1
set-current-plot "PlotXY"
plotxy x y
end

to plot2
set-current-plot "PlotXZ"
plotxy x z
end

to plot3
set-current-plot "PlotYZ"
plotxy y z
end

to plotz
set-current-plot "Plot Z"
plotxy n - 1 z
end

; Modification of an idea of 2005 Uri Wilensky.  This code may be freely copied, distributed,
; altered, or otherwise used by anyone for any legal purpose.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
; OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```

There are 2 versions of this model.