lorenz06
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
euler integration of the lorenz attractor
green square moves along the attractor leaving drops of dropcolor behind
the 'go" button cycles through 11 dropcolors of 100 drops each
OR, you may choose a dropcolor and and "step100" to leave 100 drops
the 'clear" button clears to gray
good values for the control parameter (slide) R are near the famous bifurcations:
increasing R through ---
1.000, point attractor at origin splits to two point attractors
13.926, homoclinic tangency
24.06, onset of chaos
cf sparrow, pp. 2,9,13,31
Comments and Questions
;;; lorenz.nlogo rev 05, 10 july 2005 by ralph abraham ;;; based upon lorenz04.nlogo ;;; this is a 3D model in NetLogo 3-D pre 1 ;;; NOTE: manually set screen-edge-x,y,z in 2D Graphic Window ;;; to 50 was too much, so try 17 ;;; also useful to click "2D also" OFF in 3D window ;;; fix on 25 july 2005: set shape3d "sphere" ;;; rev 05: add speed slider, zhome button, add movie script button for movie #1 breed [ particles ] breed [ drops ] breed [ titleposts ] globals [ labeltext1 labeltext2 ;;; for titles deltax deltay deltaz ;;; window widths for conversion routines deltau deltav deltaw ;;; world coord window widths umin umax vmin vmax wmin wmax ;;; from def of map-u and map-v xmin xmax ymin ymax zmin zmax ;;; from Graphics Window attributes totaltime ;;; keep track of totaltime vpradius ;;; to locate viewpoint vpangle ;;; c defined by a slider from 0 to 5 ;;; stepsize ditto from 0 to 0.1 ;;; dropcolor defined by a chooser ] ;;; procedures for runs to title0 set labeltext1 "MOVIE #0" set labeltext2 "The Axes" title wait 2 titlezoom wait 2 end to title1 set labeltext1 "MOVIE #1" set labeltext2 "The Lorenz Attractor" title wait 2 titlezoom wait 2 end to title2 set labeltext1 "MOVIE #2" set labeltext2 "Sensitive Dependence" title wait 2 titlezoom wait 2 end to movie#0 setup ;;; includes clear-all, init-globals, place particle title0 ;;; title setxyz 0 0 25 ask turtle 0 [ setxyz 0 0 0 ] ;;; mark origin crt 3 ;;; mark three axes ask turtle 1 [ set label "X" set size 3 set color red setxyz 15 0 0 ] ask turtle 2 [ set label "Y" set size 3 setxyz 0 15 0 set color blue ] ask turtle 3 [ set label "Z" set size 3 set color yellow setxyz 0 0 15 ] repeat 360 [ revolveXY ] ;;; 1/4 rotationXY wait 2 repeat 360 [ revolveXZ ] ;;; full rotationXZ end to movie#1 setup ;;; includes clear-all, init-globals, place particle title1 ;;; title test 1 , 2, zoom zhome ;;; return observer to home repeat 10 [ go ] ;;; should stop after 10 go's of 12 colors, step100's (100 steps) or 12,000 steps repeat 90 [ revolveXZ ] ;;; 1/4 full rotation zoom-in repeat 10 [ go ] end to movie#2 setup ;;; includes clear-all, init-globals, place particle title2 ;;; title test 1 , 2, zoom zhome ;;; return observer to home ask turtle 0 [ setxyz 5.1 7.2 -4.2 ] place-particle 5.1 7.2 -4.3 ask turtle 2 [ set color blue ] repeat 1000 [ wait sleeptime turnXY step ] end to movie#3 end to init-globals set totaltime 0 set xmin min-pxcor set xmax max-pxcor set ymin min-pycor set ymax max-pycor set zmin min-pzcor set zmax max-pzcor set deltax world-width - 1 ;;; this is Graphics Window attribute set deltay world-height - 1 ;;; this is Graphics Window attribute set deltaz world-depth - 1 ;;; this is Graphics Window attribute set umin -50 set umax 50 set vmin -50 set vmax 50 set wmin 0 set wmax 100 set deltau (umax - umin) set deltav (vmax - vmin) set deltaw (wmax - wmin) set vpradius 50 set vpangle 0 end ;;; more procedures to setup ca init-globals place-particle 10 10 25 end ;;; green test particles move along trajectories, leaving drops to step ask particles [ hatch-drops 1 [ set shape "circle" set color dropcolor set size 0.5 ] let xtemp xcor let ytemp ycor let ztemp zcor set xcor map-x xtemp ytemp ztemp ;;; move to image point set ycor map-y xtemp ytemp ztemp set zcor map-z xtemp ytemp ztemp ] set totaltime ( totaltime + stepsize ) end to step100 repeat 100 [ step ] end to go ;;; 1200 steps foreach [15 25 35 45 55 65 75 85 95 105 115 125] [ set dropcolor ? step100 ] end ;; create a particle at (x,y,z) to place-particle [x y z] create-particles 1 [ set xcor x set ycor y set zcor z set shape "circle" set size 3 set heading 0 set color green ] end to revolveXY wait sleeptime turnXY end to turnXY let delta 1 ;;; one degree increment set vpangle ( vpangle - delta ) ;;; minus rotates right hand rule, thumb up setxyz ( vpradius * ( cos vpangle )) (vpradius * ( sin vpangle )) 0 ;;; circle in XY plane face patch 0 0 0 end to revolveXZ wait sleeptime turnXZ end to turnXZ let delta 1 ;;; one degree increment set vpangle ( vpangle - delta ) ;;; minus rotates right hand rule, thumb up setxyz ( vpradius * ( cos vpangle )) 0 (vpradius * ( sin vpangle )) ;;; circle in XZ plane face patch 0 0 0 end ;;; reset pcolor of all patches to clear ask drops [ set color gray ] end to xhome setxyz 50 0 0 face patch 0 0 0 end to zhome setxyz 0 0 50 face patch 0 0 0 end to zoom-in zhome let t 0 while [ t < 75 ] [ wait 0.1 ;;; speed of zoom, this is medium setxyz 0 0 ( 50 - t ) face patch 0 0 0 set t ( t + 1 ) ask drops [ set size ( 0.99 * size ) ] ] end ;;; title procedures to title zhome ;;; not too far away create-titleposts 1 [ set label labeltext1 set color black set ycor 5 ] end to titlezoom let t 0 ask titleposts [ hide-turtle set label labeltext2 show-turtle ] while [ t < 15 ] ;;; 15 steps of 0.1 unit, or 1.5 second zoom [ wait 0.1 ;;; speed of zoom, 0.1 is medium setxyz -2 -2 ( 33 - t ) ;;; decriment 1 unit set t ( t + 1 ) ] end ;;; reporters ;;; ============================================== ;;; conversion functions, world-coords <--> turtle-screen-coords: ;;; horizontal: (u <--> x), vertical (v <--> y), deep (w <--> z) ;;; ---------------------------------------------- ;;; (u <-- x): u = convert(x) to-report horizconvert [ x ] let u (deltau * ( x - xmin ) / deltax) + umin report u end ;;; (u --> x): x = deconvert(u) to-report horizdeconvert [ u ] let x (deltax * ( u - umin ) / deltau) + xmin report x end ;;; (v <-- y): v = convert(y) to-report vertconvert [ y ] let v (deltav * ( y - ymin ) / deltay) + vmin report v end ;;; (v --> y): y = deconvert(v) to-report vertdeconvert [ v ] let y (deltay * ( v - vmin ) / deltav) + ymin report y end ;;; (w <-- z): w = convert(z) to-report deepconvert [ z ] let w (deltaw * ( z - zmin ) / deltaz) + wmin report w end ;;; (w --> z): z = deconvert(w) to-report deepdeconvert [ w ] let z (deltaz * ( w - wmin ) / deltaw) + zmin report z end ;;; ============================================== ;; calculate the horizontal component of the map where the turtle is located to-report map-x [ x y z] ;; turtle procedure let utemp1 horizconvert x let vtemp1 vertconvert y let wtemp1 deepconvert z let utemp2 map-u utemp1 vtemp1 wtemp1 let xtemp horizdeconvert utemp2 report xtemp end ;; calculate the vertical component of the map where the turtle is located to-report map-y [ x y z] ;; turtle procedure let utemp1 horizconvert x let vtemp1 vertconvert y let wtemp1 deepconvert z let vtemp2 map-v utemp1 vtemp1 wtemp1 let ytemp vertdeconvert vtemp2 report ytemp end ;; calculate the depth component of the map where the turtle is located to-report map-z [ x y z] ;; turtle procedure let utemp1 horizconvert x let vtemp1 vertconvert y let wtemp1 deepconvert z let wtemp2 map-w utemp1 vtemp1 wtemp1 let ztemp deepdeconvert wtemp2 report ztemp end ;;; and at last, the map in world coords ;;; LORENZ odes with euler method to-report map-u [ u v w ] let s 10 report u + stepsize * s * ( v - u ) end to-report map-v [ u v w ] ;;; let r 28 report v + stepsize * ( r * u - v - u * w ) end to-report map-w [ u v w ] let b 8 / 3 report w + stepsize * ( u * v - b * w) ;;; c is global from a slider end ;;; end of lorenz.nlogo procedures
There are 2 versions of this model.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.