Delta Banner

Mathematics & Science Learning Center
Computer Laboratory

 

Applications of Systems of Differential Equations

Predator-Prey Problems

(continued from last page...)

The Lotka-Volterra system:

System Initial Conditions
r′(t) = 2 r(t) - 0.01 r(t) f(t)
f′(t) =  - f(t) + 0.01 r(t) f(t)
r(0) = ro
f(0) = fo

is said to be coupled. This means that both equations involve both variables. As a result we must solve the equations simultaneously. We saw in an earlier lab that in such situations we can make Mathematica do the work for us, provided we know the initial conditions. Let me refresh your memory of the syntax of the NDSolve command:

?NDSolve

NDSolve[eqns,y,{x,xmin,xmax}] finds a numerical solution to the ordinary differential equations eqns for the function y with the independent variable x in the range xmin to xmax.
NDSolve[eqns,y,{x,xmin,xmax},{t,tmin,tmax}] finds a numerical solution to the partial differential equations eqns.
NDSolve[eqns,{y1,y2,…},{x,xmin,xmax}] finds numerical solutions for the functions yi.  >>

As we have already seen, when we're dealing with a system of differential equations, the third form of NDSolve listed above is the one we want. The differential equations we need to enter in the list of equations are obvious—they're given in the Lotka-Volterra system at the top of this page, but what about the initial conditions?

Well the initial conditions are simply the two original population sizes. Let's say that there were originally 300 rabbits and 150 foxes. This translates into the initial conditions:

  • r(0) = 300
  • f(0) = 150

Putting these together with the original system of differential equations, we have everything we need to enter into the NDSolve command. Whoops! No we don't! We also need to specify an interval upon which the numerical solution is to be found. Let's use 0 ≤ t ≤ 10.

If we want to read the answer into the variable rabfox1, the command becomes:

rabfox1=NDSolve[{r'[t]==2r[t]-0.01 r[t] f[t],
   f'[t]==-f[t]+0.01 r[t] f[t],
   r[0]==300,f[0]==150},
   {r[t],f[t]},{t,0,10}]

Go ahead—enter and evaluate it!


Mathematica Icon You can switch to Mathematica by clicking on the button at left. This will open up a fresh notebook for you. Remember that it will take it a while to start up! Don't forget to come back here when you're done! See you in a few minutes.

Now let's go see what you should have gotten...


Compass If you're lost, impatient, want an overview of this laboratory assignment, or maybe even all three, you can click on the compass button on the left to go to the table of contents for this laboratory assignment.
 
 

ODE Laboratories: A Sabbatical Project by Christopher A. Barker

©2017 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA
e-mail:
cbarker@deltacollege.edu