Author Topic: A Few Attractors...  (Read 2265 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
A Few Attractors...
« on: November 24, 2009, 08:12:12 PM »
Another interesting area of Mathematics... thought a few of you may be interested  :wink:

Lorenz Attractor:



Rössler Attractor:



Duffing's Attractor



Code: [Select]
(defun c:lorenz (/ iLim i h a b c x0 y0 z0 x y z)

  (setq iLim 10000 i -1 h 0.01 a 10. b 28. c (/ 8. 3.) x0 0.1 y0 0. z0 0.)

  (entmake '((0 . "POLYLINE") (70 . 8)))
  (while (< (setq i (1+ i)) iLim)

    (setq x (+ x0 (* h a (- y0 x0)))
          y (+ y0 (* h (- (* x0 (- b z0)) y0)))
          z (+ z0 (* h (- (* x0 y0) (* c z0)))) x0 x y0 y z0 z)
    (entmake (list '(0 . "VERTEX") '(70 . 32) (cons 10 (list x y z)))))
 
  (entmake '((0 . "SEQEND")))
  (princ))



(defun c:rossler (/ iLim i h a b c x0 y0 z0 x y z)

  (setq iLim 10000 i -1 h 0.01 a 0.2 b 0.2 c 5.7 x0 0.1 y0 0. z0 0.)

  (entmake '((0 . "POLYLINE") (70 . 8)))
  (while (< (setq i (1+ i)) iLim)

    (setq x (+ x0 (* h (- (- y0) z0)))
          y (+ y0 (* h (+ x0 (* a y0))))
          z (+ z0 (* h (+ b (* z0 (- x0 c))))) x0 x y0 y z0 z)
    (entmake (list '(0 . "VERTEX") '(70 . 32) (cons 10 (list x y z)))))

  (entmake '((0 . "SEQEND")))
  (princ))


(defun c:duffings (/ iLim i h a b x0 y0 z0 x y z)

  (setq iLim 10000 i -1 h 0.04 a 0.2 b 0.3 x0 0. y0 0. z0 0.)

  (entmake '((0 . "POLYLINE") (70 . 8)))
  (while (< (setq i (1+ i)) iLim)

    (setq x (+ x0 (* h y0))
          y (+ y0 (* h (+ (- x0 (* x0 x0 x0) (* a y0)) (* b (cos z0)))))
          z (+ z0 h) x0 x y0 y z0 z)   
    (entmake (list '(0 . "VERTEX") '(70 . 32) (cons 10 (list x y z)))))
 
  (entmake '((0 . "SEQEND")))
  (princ))

{ Various Attractors can be obtained by varying the values of a,b,c in the above code }

Enjoy!

Lee
« Last Edit: November 27, 2009, 12:39:41 PM by Lee Mac »

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: A Few Attractors...
« Reply #1 on: November 27, 2009, 12:41:25 PM »
Updated to include the Duffings Attractor  :wink: