Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

p4i.

wxmx 1 / 3

Practical : 4
(i) Predator-prey
model
LOTKA VOLTERRA PREDATOR - PREY SYSTEM WHERE
DDT HAS
BEEN SPREYED
p4i.wxmx 2 / 3

➔ kill(all)$
depends([x,y],t)$
'b1=b1:1.0; 'a2=a2:0.5; c1=c1:0.01; 'c2=c2:0.005;
'p1=p1:0.1; 'p2=p2:0.1;
eq1:diff(x,t)=b1·x−c1·x·y−p1·x;
eqn2:diff(y,t)=c2·x·y−a2·y−p2·y;
points:rk([rhs(eq1),rhs(eqn2)],[x,y],[200,80],[t,0,20,0.1])$
[%[1],last(%),length(%)];
xL:makelist([points[i][1],points[i][2]],i,1,length(points))$
[%[1],last(%),length(%)];
yL:makelist([points[i][1],points[i][3]],i,1,length(points))$
[%[1],last(%),length(%)];
wxplot2d
([[discrete,xL],[discrete,yL]],
[x,0,20],[style,[lines,2],[lines,3]],[y,0,240],
[ylabel,"population density"],
[xlabel,"t years"],[legend,"x(t) preys","y(t) predators"])$
(%o2) b1 = 1.0
(%o3) a2 = 0.5
(%o4) c1 = 0.01
(%o5) c2 = 0.005
(%o6) p1 = 0.1
(%o7) p2 = 0.1
d
(%o8) x = 0.9 x − 0.01 x y
dt
d
(%o9) y = 0.005 x y − 0.6 y
dt
(%o11) [ [ 0.0 , 200.0 , 80.0 ] , [ 20.0 , 94.9961084048835 ,
134.7757919917374 ] , 201 ]
(%o13) [ [ 0.0 , 200.0 ] , [ 20.0 , 94.9961084048835 ] , 201 ]
(%o15) [ [ 0.0 , 80.0 ] , [ 20.0 , 134.7757919917374 ] , 201 ]

(%t16)
p4i.wxmx 3 / 3

LOTKA VOLTERRA PREDATOR - PREY SYSTEM of


competing
species

➔ kill(all)$
depends([x,y],t)$
'b1=b1:3.0; 'b2=b2:2.5; c1=c1:2; 'c2=c2:1;
eq1:diff(x,t)=b1·x−c1·x·y;
eqn2:diff(y,t)=b2·y−c2·x·y;
points:rk([rhs(eq1),rhs(eqn2)],[x,y],[3,1.5],[t,0,20,0.1])$
[%[1],last(%),length(%)];
xL:makelist([points[i][1],points[i][2]],i,1,length(points))$
[%[1],last(%),length(%)];
yL:makelist([points[i][1],points[i][3]],i,1,length(points))$
[%[1],last(%),length(%)];
wxplot2d([[discrete,xL],[discrete,yL]],[x,0,1.5],
[style,[lines,2],[lines,3]],[y,0,20],
[ylabel,"population density"],[xlabel,"t years"],
[legend,"Species X","Species Y"])$
(%o2) b1 = 3.0
(%o3) b2 = 2.5
(%o4) c1 = 2
(%o5) c2 = 1
d
(%o6) x = 3.0 x − 2 x y
dt
d
(%o7) y = 2.5 y − x y
dt
56
(%o9) [ [ 0.0 , 3.0 , 1.5 ] , [ 2.0 , − 1.534034451582024 10 ,−
55
7.670172257910122 10 ] , 21 ]
56
(%o11) [ [ 0.0 , 3.0 ] , [ 2.0 , − 1.534034451582024 10 ] , 21 ]
55
(%o13) [ [ 0.0 , 1.5 ] , [ 2.0 , − 7.670172257910122 10 ] , 21 ]

(%t14)

You might also like