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

LOGO-L> Volterra's model



;Hello Everybody
;Here again a revised version of the Volterra selashian - food fish
;interaction.(pridator-prey relation).
;With this new set of constants; if you experiment changing only one
;constant in the two functions represnted by fun1 & fun2 ; each time you 
;will get a different remaining number of each spice.
;But increasing or decreasing the initial number of any of the two spices
;will have no effect on the final steady state equilibrium.
;Please try experimenting;any comments will be appreciated (hi Yehuda!!).
;Best Regards.
;Mhelhefny
;----------------------  
to axis :a :b
setpc 3 pu setxy :a :b pd fd 200 label [number] 
bk 200 rt 90 fd 320 label [time] bk 320 lt 90
end

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* .10   - :x* :y* .01 - :x* :x* .001]
make "fun2 [- :y* .10   + :x* :y* .01 - :y* :y* .001]
make "x0 40 make "t0 0 make "tf 6 make "h .01
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.]
pr [Volterra has formulated this mathematical model in 1932.]
end

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

to plot :b
repeat :n[make "aa repcount* :h* :scale.a
             make "bb item repcount :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 70
make "scale.a 40         make "scale.b 5
pu plot :xx              axis :origin.x :origin.y
pu setxy -250 200        pd label[food fish]
end

to plot2 
setpc 6
make "origin.x -350      make "origin.y -200
make "scale.a 40         make "scale.b 5 
pu plot :yy              axis :origin.x :origin.y
pu setxy -250 -40        pd label[selashians] 
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
repeat :n[make "x :x+ run :fun1 make "y :y+ run :fun2 
setitem repcount :xx :x setitem repcount :yy :y 
setxy 140+ :x*5 -200+ :y*5 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
;-------------------------
---------------------------------------------------------------
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