Applications of Systems of Differential Equations

Predator-Prey Problems

(continued from last page...)

Mathematica should have eventually returned the following:

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}]

Notice the form of the answer—a list of two replacement rules. This is not surprising—after all we were solving for two functions, rabbits as a function of time, and foxes as a function of time. If you remember the laboratory on solving systems that you completed earlier, then the form of this solution should look familiar to you. Our next task is to extract the pieces of this solution into two different variables, the first one representing the rabbit component of the solution, and the second one representing the fox component of the solution.

We have learned previously that the "[[1,#,2]] trick" is the quickest way to extract pieces from a numerical solution of this form. We'll now use the trick twice, as follows:

rab1=rabfox1[[1,1,2]]
fox1=rabfox1[[1,2,2]]

Go to Mathematica now, and issue both commands, hitting [ENTER] after each one, then return here.

Now let's move on...

 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