Mathematics & Science
Learning Center |
|||
Applications of Systems of Differential EquationsPredator-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], 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]] Go to Mathematica now, and issue both commands, hitting [ENTER] after each one, then return here. Now let's move on... |
|||
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 |