[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> logo in biology



;Hello Everybody
;Here is another example demonstating Pridator-Prey relation.
;This model was formulated by the famous Italian mathematical
;biologist E. Volterra.
;The model solves the two simultaneous D.E. equations:-
;
;             dx/dt = a*x + b*xy + c*x*x   &
;             dy/dt = d*y + e*xy + f*y*y
;
;constants are given in fun1 & fun2 of the initial procedure.
;Best Regards
;Mhelhefny
;---------------------

to final
ts ct pr (se "FINAL "SUMMARY ":) pr "
type (se "1 "-) summary :x01 :y01 :u :v 
type (se "2 "-) summary :x02 :y02 :s :w
end

to go
cs ht make "y0 40 make "flag 1 initial solve plot1 plot2 plot3 
memorize summary :x01 :y01 :u :v                         next
cs    make "y0 80 make "flag 2 initial solve plot1 plot2 plot3 
memorize summary :x02 :y02 :s :w                         next
final moral
end 

to initial
make "fun1 [  :x* .200   - :x* :y* .010 - :x* :x* .0004]
make "fun2 [- :y* .040   + :x* :y* .007 - :y* :y* .0008]
make "x0 40 make "t0 0 make "tf 20 make "h .02
make "n (:tf/ :h)-1
make "xx array :n     make "yy array :n     make "tt array :n
end

to memorize
ifelse :flag=1[make "u round :x make "v round :y make "x01 :x0 make "y01 :y0][ 
               make "s round :x make "w round :y make "x02 :x0 make "y02 :y0] 
end

to moral
pr " pr [comment :] pr "
pr [The increase of The initial number of pridator (:Selashian fish)]
pr [will not destroy The prey (:food fish) as one may expect .On the]
pr [contrary the prey will benifit from that.Volterra has formulated]
pr [this mathematical model in 1932 )] pr "
pr [The increased use of insecticieds (DDT) may eventually increase]
pr [insects] pr "
end

to next
type (se "prees "any "key char 9) make "ss rc
end

to plot :b
for [i 1 :n][make "aa :i* :h* :scale.a
             make "bb item :i :b make "bb :bb* :scale.b
             setxy :origin.x+ :aa  :origin.y+ :bb pd]
end 

to plot1
setpc 5
make "origin.x -350      make "origin.y 100
make "scale.a 20         make "scale.b 3
pu plot :xx          pu setxy -250 200        
pd label[X against T]
end

to plot2 
setpc 6
make "origin.x -350       make "origin.y -200
make "scale.a 20          make "scale.b 3 
pu plot :yy           pu setxy -250 -40 
pd label[Y against T] 
end

to plot3
pu setxy -30 220          pd rt 90 label[Selashian - Foodfish MODEL] 
pu setxy 170 60           pd label (se "X "against "Y)
pu setxy 170 30           pd label (se "x0= :x0 "xf= round :x)
pu setxy 170 10           pd label (se "y0= :y0 "yf= round :y)
end

to solve
make "x :x0    make "y :y0     setpc 4 pu
for [i 1 :n][make "x1 run :fun1 make "y1 run :fun2 make "x :x+ :x1 make "y :y+
:y1 
setitem :i :xx :x setitem :i :yy :y 
setxy 140+ :x*3 -200+ :y*3 pd
]
end

to summary :e :f :g :h  
type (se "foodfish  "decreased "from :e "to :g char 9) 
type (se "selashians "decreased "from :f "to :h char 9) pr "
end
;------------------------Z
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home