2.1 Modeling via Systems

September 23, 1998

Predator-Prey (Foxes and Rabbits)

We'll examine here the system dR/dt = 3*R-Float(14, -1)*RF , dF/dt = -F+Float(5, -1)*RF .

First note that our friend dsolve doesn't seem to help us much.

> dsolve({D(R)(t)=3*R(t)-1.4*R(t)*F(t),D(F)(t)=-F(t)+0.5*R(t)*F(t)},
[R(t),F(t)]);

{t-1000000000*ln(R(t))-40000*sqrt(2500000000+5*_C1*R(t))+2000000000*arctanh(1/50000*sqrt(2500000000+5*_C1*R(t)))+_C2 = 0}, {F(t) = .7142857143*(-1.*diff(R(t), t)+3.*R(t))/R(t)}{t-1000000000*ln(R(t))-40000*sqrt(2500000000+5*_C1*R(t))+2000000000*arctanh(1/50000*sqrt(2500000000+5*_C1*R(t)))+_C2 = 0}, {F(t) = .7142857143*(-1.*diff(R(t), t)+3.*R(t))/R(t)}{t-1000000000*ln(R(t))-40000*sqrt(2500000000+5*_C1*R(t))+2000000000*arctanh(1/50000*sqrt(2500000000+5*_C1*R(t)))+_C2 = 0}, {F(t) = .7142857143*(-1.*diff(R(t), t)+3.*R(t))/R(t)}{t-1000000000*ln(R(t))-40000*sqrt(2500000000+5*_C1*R(t))+2000000000*arctanh(1/50000*sqrt(2500000000+5*_C1*R(t)))+_C2 = 0}, {F(t) = .7142857143*(-1.*diff(R(t), t)+3.*R(t))/R(t)}

We can solve numerically by requesting the appropriate option in dsolve.

> g:=dsolve({D(R)(t)=3*R(t)-1.4*R(t)*F(t),D(F)(t)=-F(t)+0.5*R(t)*F(t),
              R(0)=2,F(0)=2},

         [R(t),F(t)],

         numeric);

g := proc (rkf45_x) local i, rkf45_s, outpoint, r1, r2; option `Copyright (c) 1993 by the University of Waterloo. All rights reserved.`; global loc_control, loc_y0, loc_y1; outpoint := evalf(rkf45_x);...

We get a procedure as an output.  The procedure inputs a value of t and outputs three equations, the equations for t , R and F .

> g(0);

[t = 0, R(t) = 2., F(t) = 2.]

> g(1);

[t = 1, R(t) = 2.241347450253796, F(t) = 2.169786859825192]

Using the command odeplot (in the package plots) we can graph the solutions.

> with(plots):

> plot1:=odeplot(g,[t,R(t)],0..10):
plot2:=odeplot(g,[t,F(t)],0..10,color=blue):

Here are the two functions plotted on the same pair of axes.

> display([plot1,plot2]);

[Plot]

Here we have a 3D plot.

> odeplot(g,[t,R(t),F(t)],0..10,axes=boxed,color=red);

[Plot]

Here is an attempt to get a phase plane picture.  Note that the inaccuracies in the numerical picture give us a fuzzy picture.  

> odeplot(g,[R(t),F(t)],0..10);

[Plot]

If we increase numpoints from the default 50 to 500, the picture smooths out.  It certainly looks like the solution here is periodic.

> odeplot(g,[R(t),F(t)],0..10,numpoints=500);

[Plot]

The period seems to be a little over 3.6.

> odeplot(g,[R(t),F(t)],0..3.6,numpoints=500);

[Plot]

Here's another cute command that can get you a nice picture of the phase plane.  Here there are three initial conditions specified.

> phaseportrait(
[D(R)(t)=3*R(t)-1.4*R(t)*F(t),D(F)(t)=-F(t)+0.5*R(t)*F(t)],

[R(t),F(t)],

t=0..6,

[[R(0)=2,F(0)=2],[R(0)=2,F(0)=1],[R(0)=1,F(0)=2]],

stepsize=.05

);

[Plot]

Modified Predator Prey - Logistic Growth for Rabbits

Here we make the rabbits growth pattern one of logistic growth with a carrying capacity of 4.

> phaseportrait(
[D(R)(t)=3*R(t)*(1-R(t)/4)-1.4*R(t)*F(t),D(F)(t)=-F(t)+0.5*R(t)*F(t)],

[R(t),F(t)],

t=0..6,

[[R(0)=2,F(0)=2],[R(0)=2,F(0)=1],[R(0)=1,F(0)=2]],

stepsize=.05

);

[Plot]

Note that the equilibrium point has moved.  It is now at

> solve({3*R*(1-R/4)-1.4*R*F=0,
-F+0.5*R*F=0},{R,F});

{R = 0, F = 0}, {R = 4., F = 0}, {F = 1.071428571, R = 2.}

> g2:=dsolve({D(R)(t)=3*R(t)*(1-R(t)/4)-1.4*R(t)*F(t),
D(F)(t)=-F(t)+0.5*R(t)*F(t),

R(0)=2,F(0)=1},

[R(t),F(t)],

numeric);

g2 := proc (rkf45_x) local i, rkf45_s, outpoint, r1, r2; option `Copyright (c) 1993 by the University of Waterloo. All rights reserved.`; global loc_control, loc_y0, loc_y1; outpoint := evalf(rkf45_x)...

> g2(0);

[t = 0, R(t) = 2., F(t) = 1.]

> g2(1);

[t = 1, R(t) = 2.082095204764766, F(t) = 1.029629321624007]

> plot21:=odeplot(g2,[t,R(t)],0..10):
plot22:=odeplot(g2,[t,F(t)],0..10,color=blue):

> display([plot21,plot22]);

[Plot]