Predator-Prey Problems - Page 2
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...







