;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; #| This is the basic model of Periodic and Chaotic Host-Parasite Interactios in Human Malaria Dominic Kwiatkowski, Martin Nowak Proceedings of the National Academy of Sciences of the United States of America, Vol. 88, No. 12 (Jun. 15, 1991), pp. 5111-5113 My expected equilibria aren't coming out right: don't know why.... yt = (* d1 xt (f xt)) xt = (* r d2 yt (g xt))) Therefore xt = (* r d2 (* d1 xt (f xt)) (g xt))) 1 = (* r d2 d1 (f xt) (g xt)) 1 = (* r d2 d1 (exp (- (+ s p) (trans xt)))) (exp (* (+ s p) (trans xt))) = (* r d2 d1) (* (+ s p) (trans xt)) = (ln (* r d2 d1)) (trans xt) = (ln (* r d2 d1))/(+ s p) xt = (arctrans (ln (* r d2 d1))/(+ s p)) |# ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun run(r &key (p .00001) (s .001) (d1 1) (d2 1) (n 50) (x 1) (y 1) (trans (lambda(x) x)) (arctrans (lambda(x) x)) ) " ;; Example (run 2 :n 150) (run 2 :n 500 :x .001 :y .001) (run 24 :n 150) (run 32 :n 1000) (run 32 :p .001 :s .001 :n 1000) (run 12 :p .001 :s .001 :n 1000) (run 2 :n 150 :trans (lambda(x) (square x)) :arctrans (lambda(x) (sqrt x)) ) (run 2 :n 300 :trans (lambda(x) (exp (* .001 x))) :arctrans (lambda(x) (* 1000 (ln x))) ) " (flet ( (f(x) (exp (* -1 p (funcall trans x))) ) (g(x) (exp (* -1 s (funcall trans x))) ) ) (setq y (if y (list y) (let ((val (final x))) (list (* val d1 (f val))))) ) (dotimes (i n) (let ( (xt (final x)) (yt (final y)) ) (setq y (combine y (* d1 xt (f xt))) x (combine x (* r d2 yt (g xt))) ) ) ) (title (format nil "young parasites: r=~d; d1=~,2f; d2=~,2f; p=~,2e; s=~,2e" r d1 d2 p s) ) (send (plotter x) :size 600 300) (send my-plot :add-plot-item (list 'lines (list 0 (length x)) (let ((val (funcall arctrans (/ (ln (* r d1 d2)) (+ s p))))) (list val val) ) 'black ) ) (title (format nil "old parasites: r=~d; d1=~,2f; d2=~,2f; p=~,2e; s=~,2e" r d1 d2 p s ) ) (send (plotter y) :size 600 300) (send my-plot :add-plot-item (list 'lines (list 0 (length x)) (let* ( (val (funcall arctrans (/ (ln (* r d1 d2)) (+ s p)))) (yend (* d1 val (f val))) ) (list yend yend) ) 'black ) ) (title (format nil "combined parasites: r=~d; d1=~,2f; d2=~,2f; p=~,2e; s=~,2e" r d1 d2 p s ) ) (send (plotter (log (+ x y) 10)) :size 600 300) (send my-plot :add-plot-item (list 'lines (list 0 (length x)) (let* ( (val (funcall arctrans (/ (ln (* r d1 d2)) (+ s p)))) (yend (* d1 val (f val))) ) (log (list (+ val yend) (+ val yend)) 10) ) 'black ) ) (title (format nil "young against old parasites: r=~d; d1=~,2f; d2=~,2f; p=~,2e; s=~,2e" r d1 d2 p s ) ) (plotter x y) (send my-plot :add-plot-item (list 'points (let* ( (val (funcall arctrans (/ (ln (* r d1 d2)) (+ s p)))) ) (list val) ) (let* ( (val (funcall arctrans (/ (ln (* r d1 d2)) (+ s p)))) (yend (* d1 val (f val))) ) (format t "~,2f young~%~,2f old~%" val yend) (list yend) ) 'black ) ) ) )