; Draws the Lorenz attractor ; Alejandro Luque Estepa, 1999 (import "zlisp.LispMath") (import "zlisp.LispGraph") (defun lorenz (a b c dt n) (do ( (i 0 (add1 i)) (dx 0.0 (* a (- y x) dt)) (dy 0.0 (* (- (* b x) y (* z x)) dt) ) (dz 0.0 (* (- (* x y) (* c z)) dt)) (x 1.0 (+ x dx)) (y 1.0 (+ y dy)) (z 1.0 (+ z dz))) ((> i n) (msg "Lorenz attractor finished" t)) (color 1.0 0.0 0.0) (point (round (+ 70 (* x 7))) (round (+ 100 (* y 7)))) (color 0.0 1.0 0.0) (point (round (+ 410 (* x 7))) (round (+ 20 (* z 7)))) (color 0.0 0.0 1.0) (point (round (+ 150 (* z 7))) (round (+ 100 (* y 7)))) ) ) (msg "lorenz.lisp.txt : zlisp 0.1 Demonstration program" t "(lorenz a b c dt N) draws N points of the Lorenz attractor with parameters a, b, c, dt" t "Type (lorenz 5.0 15.0 1.0 0.01 5000) to view a chaotic figure" t )