The Logistic Equation
(with-open-file (*standard-output* "logistic.txt" :direction :output
:if-exists :supersede)
(let* ((x 0.5)
(r-env '(0 1 1000 4.0))
(r 0.0))
(loop for i below 1000 do
(setf r (envelope-interp i r-env)
x (* r (* x (- 1 x))))
(format t "~D ~D~%" r x)
)))
The Henon Map
(with-open-file (*standard-output* "henon.txt" :direction :output
:if-exists :supersede)
(let* ((x 0.1)
(y 0.1)
(a 1.4)
(b 0.3)
(z 0.0))
(loop for i below 500 do
(setf z x
x (-(+ y 1) (* a (* x x)))
y (* b z))
(format t "~D ~D~%" x y))))
The Lorenz Attractor
(with-open-file (*standard-output* "lorenz.txt" :direction :output
:if-exists :supersede)
(let* ((x1 0.0)
(y1 1.0)
(z1 0.0)
(dt 0.001)
(x 0.0)
(y 0.0)
(z 0.0)
(a 10)
(b (/ 8 3))
(p 28))
(loop for i below 1000 do
(setf x (+ x1 (* (* a (- y1 x1)) dt))
y (+ y1 (* (- y1 (* x1 (- p z1))) dt))
z (+ z1 (* (- (* x1 y1) (* b z1)) dt))
x1 x
y1 y
z1 z)
(format t "~D ~D ~D~%" (* 1000 x) (* 1000 y) (* 1000 z)))))
The Ikeda Map
(with-open-file (*standard-output* "ikeda.txt" :direction :output
:if-exists :supersede)
(let* ((x 1.0)
(y 1.0)
(u 0.95)
(z 0.0)
(b 0.0))
(loop for i below 1000 do
(setf z x
b (- 0.4 (/ 6 (+ 1 (+ (* x x) (* y y)))))
x (+ 1 (* u (- (* x (cos b)) (* y (sin b)))))
y (* u (+ (* z (sin b)) (+ y (cos b)))))
(format t "~D ~D~%" x y))))
The Tent Map
(with-open-file (*standard-output* "tent.txt" :direction :output
:if-exists :supersede)
(let* ((x 0.5)
(u 0.0)
(u-env '(0 1 1000 2.0)))
(loop for i below 1000 do
(if (< x 0.5)
(progn
(setf u (envelope-interp i u-env)
x (* u x))
(format t "~D ~D~%" x u))
(progn
(setf u (envelope-interp i u-env)
x (* u (- 1 x)))
(format t "~D ~D~%" u x))))))
The Gauss Iterated Map
(with-open-file (*standard-output* "gauss.txt" :direction :output
:if-exists :supersede)
(let* ((x 0.0)
(a 6.2)
(b-env '(0 -1 500 1))
(b 0.0))
(loop for i below 500 do
(setf b (envelope-interp i b-env)
x (+ b (exp(* (* -1 a) (* x x)))))
(format t "~D ~D~%" i x))))
The Tinkerbell Map
(with-open-file (*standard-output* "tinkbell.txt" :direction :output
:if-exists :supersede)
(let* ((x -0.72)
(y -0.64)
(a 0.9)
(b -0.6013)
(c 2)
(d 0.5)
(z 0.0))
(loop for i below 2500 do
(setf z x
x (+ (* b y) (+ (* a x) (- (* x x) (* y y))))
y (+ (* d y) (+ (* c z) (* 2 (* z y)))))
(format t "~D ~D~%" x y))))
The Rabinovich-Fabrikant Equation
The graph may not look like those from other resources but that's because it was not ran over enough iterations, changing the loop value to over 1000 produces the main graph shape.
(with-open-file (*standard-output* "rabfab.txt" :direction :output
:if-exists :supersede)
(let* ((x1 -1.0)
(y1 0.0)
(z1 0.5)
(dt 0.01)
(x 0.0)
(y 0.0)
(z 0.0)
(a 0.14)
(g 0.1))
(loop for i below 1000 do
(setf x (+ x1 (* (+ (* g x1) (* y1 (+ (* x1 x1) (- z1 1)))) dt))
y (+ y1 (* (+ (* g y1) (* x1 (- (+ (* 3 z1) 1) (* x1 x1)))) dt))
z (+ z1 (* (* (* 2 -1) z1) (+ a (* x1 y1)) dt))
x1 x
y1 y
z1 z)
(format t "~D ~D ~D~%" (* 1000 x) (* 1000 y) (* 1000 z)))))
The Torus Knot
(with-open-file (*standard-output* "torus.txt" :direction :output
:if-exists :supersede)
(let* ((x 0.0)
(y 0.0)
(z 0.0)
(r 0.0)
(q 5)
(p 2)
(phi 0.0)
(phi-env '(0 0 1000 6.283)))
(loop for i below 1000 do
(setf phi (envelope-interp i phi-env)
r (+ (cos (* q phi)) 2)
x (* r (cos (* p phi)))
y (* r (sin (* p phi)))
z (sin (* q phi)))
(format t "~D ~D ~D~%" x y z))))
The Van Der-Pol Oscillator
(with-open-file (*standard-output* "vdp.txt" :direction :output
:if-exists :supersede)
(let* ((x1 0.5)
(y1 1.0)
(x 0.0)
(y 0.0)
(u 6.0)
(dt 0.1))
(loop for i below 10000 do
(setf x (+ x1 (* (* u (- (- x1 (* (/ 1 3) (* x1 (* x1 x1)))) y1)) dt))
y (+ y1 (* (* (/ 1 u) x1) dt))
x1 x
y1 y)
(format t "~D ~D~%" y x))))
No comments:
Post a Comment