Predator and Prey Model
The following was implemented in Maple by Marcus Davidsson (2008) davidsson_marcus@hotmail.com
Outline of Problem
Rabbits and foxes are living in a confined area.
Rabbits are eating grass which there are plentiful of.
Foxes are eating rabbits.
We can now set up a model which will enable us to model the number of rabbits and foxes at any given time.
We assume that:
the number of rabbits at time t is denoted by x(t) and the number of foxes at time t is denoted by y(t).
The equation of motion for the rabbit population is given by
dx/dt = x(t) ? x(t)*y(t)
The equation of motion for the fox population is given by
dy/dt = x(t)*y(t) - y(t)
The initial rabbit population is given by x(0) =1.5 and the initial fox population is given by y(0) =0.5
We can now visualize the dynamics of the number of rabbits and foxes over time
Rabbit Population Over Time
![[diff(x(t), t) = `+`(x(t), `-`(`*`(x(t), `*`(y(t))))), diff(y(t), t) = `+`(`*`(x(t), `*`(y(t))), `-`(y(t)))]](/view.aspx?SI=6819/Predator_and_Prey_3.gif) |
(1) |
![`:=`(Rab, DEplot(sys, [x(t), y(t)], t = 0 .. 13, {[0, 1.5, .5]}, stepsize = .1, scene = [t, x(t)], linecolor = 'blue')); -1; display({Rab}, title =](/view.aspx?SI=6819/Predator_and_Prey_4.gif)
Fox Population Over Time
![[diff(x(t), t) = `+`(x(t), `-`(`*`(x(t), `*`(y(t))))), diff(y(t), t) = `+`(`*`(x(t), `*`(y(t))), `-`(y(t)))]](/view.aspx?SI=6819/Predator_and_Prey_8.gif) |
(2) |
![`:=`(Fox, DEplot(sys, [x(t), y(t)], t = 0 .. 13, {[0, 1.5, .5]}, stepsize = .1, scene = [t, y(t)], linecolor = 'red')); -1; display({Fox}, title =](/view.aspx?SI=6819/Predator_and_Prey_9.gif)
Rabbit and Fox Population Over Time
![[diff(x(t), t) = `+`(x(t), `-`(`*`(x(t), `*`(y(t))))), diff(y(t), t) = `+`(`*`(x(t), `*`(y(t))), `-`(y(t)))]](/view.aspx?SI=6819/Predator_and_Prey_13.gif) |
(3) |
![`:=`(Rab, DEplot(sys, [x(t), y(t)], t = 0 .. 13, {[0, 1.5, .5]}, stepsize = .1, scene = [t, x(t)], linecolor = 'blue')); -1; `:=`(Fox, DEplot(sys, [x(t), y(t)], t = 0 .. 13, {[0, 1.5, .5]}, stepsize =...](/view.aspx?SI=6819/Predator_and_Prey_14.gif)
![`:=`(Rab, DEplot(sys, [x(t), y(t)], t = 0 .. 13, {[0, 1.5, .5]}, stepsize = .1, scene = [t, x(t)], linecolor = 'blue')); -1; `:=`(Fox, DEplot(sys, [x(t), y(t)], t = 0 .. 13, {[0, 1.5, .5]}, stepsize =...](/view.aspx?SI=6819/Predator_and_Prey_15.gif)
Phase Diagram in a 2D Plane






Phase Diagram in a 3D Space
Our general function is given by
 |
(4) |
The derivative with respect to time (chain rule) for the above funcion is given by
 |
(5) |
We know that our two differential equations are given by
1) diff(x(t),t) = x-x*y 2) diff(y(t),t) = x*y-y
If we plug that into the previous equation we get:
 |
(6) |
The solution to the above partial differential equations is given by:
 |
(7) |
Note that only equations with closed form solutions is possible to solve with pdsolve
In order for F(x,y)= constant for example F(x,y)=1 then _F1 has to be equal to 1/(x*y*exp(-y-x))
 |
(8) |
We now plot that function with its corresponding contour lines:
![plot3d(_F1, x = 0 .. 2.7, y = 0 .. 2.7, axes = box, style = surfacecontour, labels = [x, y, time], view = [0 .. 2.7, 0 .. 2.7, 7 .. 15]); 1](/view.aspx?SI=6819/Predator_and_Prey_37.gif)
Legal Notice: The copyright for this application is owned by the authors. Neither Maplesoft nor the authors are responsible for any errors contained within and are not liable for any damages resulting from the use of this material.. This application is intended for non-commercial, non-profit use only. Contact the authors for permission if you wish to use this application in for-profit activities.