predator_prey_ode


predator_prey_ode, an Octave code which solves a pair of ordinary differential equations (ODEs) that model a pair of predator and prey populations.

The physical system under consideration is a pair of animal populations.

The PREY reproduce rapidly; for each animal alive at the beginning of the year, two more will be born by the end of the year. The prey do not have a natural death rate; instead, they only die by being eaten by the predator. Every prey animal has 1 chance in 1000 of being eaten in a given year by a given predator.

The PREDATORS only die of starvation, but this happens very quickly. If unfed, a predator will tend to starve in about 1/10 of a year. On the other hand, the predator reproduction rate is dependent on eating prey, and the chances of this depend on the number of available prey.

The resulting differential equations can be written:

        PREY(0) = 5000         
        PRED(0) =  100
  
        d PREY / dT =    2 * PREY(T) - 0.001 * PREY(T) * PRED(T)
        d PRED / dT = - 10 * PRED(T) + 0.002 * PREY(T) * PRED(T)
      
Here, the initial values (5000,100) are a somewhat arbitrary starting point.

The pair of ordinary differential equations that result have an interesting behavior. For certain choices of the interaction coefficients (such as those given here), the populations of predator and prey will tend to a periodic oscillation. The two populations will be out of phase; the number of prey will rise, then after a delay, the predators will rise as the prey begins to fall, causing the predator population to crash again.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

predator_prey_ode is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and an Octave version and a Python version.

Related Data and codes:

allen_cahn_ode, an Octave code which sets up and solves the 1D Allen-Cahn reaction-diffusion ordinary differential equation (ODE).

arenstorf_ode, an Octave code which describes an ordinary differential equation (ODE) which defines a stable periodic orbit of a spacecraft around the Earth and the Moon.

biochemical_linear_ode, an Octave code which defines a linear biochemical ordinary differential equation (ODE).

biochemical_nonlinear_ode, an Octave code which defines a nonlinear biochemical ordinary differential equation (ODE).

brusselator_ode, an Octave code which defines the Brusselator ordinary differential equation (ODE) system.

double_pendulum_ode, an Octave code which defines the double pendulum ordinary differential equation (ODE).

fd_predator_prey, an Octave code which solves a pair of predator prey ODE's using a finite difference approximation.

fd1d_predator_prey, an Octave code which implements a finite difference algorithm for predator-prey system with spatial variation in 1D.

fd2d_predator_prey, an Octave code which implements a finite difference algorithm for a predator-prey system with spatial variation in 2D.

flame_ode, an Octave code which considers an ordinary differential equation (ODE) which models the growth of a ball of flame in a combustion process.

henon_heiles_ode, an Octave code which solves the Henon-Heiles system of ordinary differential equations (ODE) which model the motion of a star around the galactic center.

humps_ode, an Octave code which solves an ordinary differential equation (ODE) whose solution is a double hump curve.

kepler_ode, an Octave code which defines a Kepler two body gravitational problem.

kepler_perturbed_ode, an Octave code which defines a perturbed Kepler two body gravitational problem.

lorenz_ode, an Octave code which approximates solutions to the Lorenz system, creating output files that can be displayed by gnuplot.

normal_ode, an Octave code which sets up an ordinary differential equation (ODE) for the normal probability density function (PDF).

oscillator_ode, an Octave code which defines the highly oscillatory ordinary differential equation (ODE).

pendulum_nonlinear_ode, an Octave code which sets up the ordinary differential equations (ODE) that represent a nonlinear model ofthe behavior of a pendulum of length L under a gravitational force of strength G.

pendulum_ode, an Octave code which sets up the ordinary differential equations (ODE) that represent a linear model ofthe behavior of a pendulum of length L under a gravitational force of strength G.

predator_prey_ode_test

quadex_ode, an Octave code which solves a stiff ordinary differential equation (ODE), whose exact solution is a parabola, but for which errors grow exponentially.

quasiperiodic_ode, an Octave code which sets up a system of ordinary differential equations (ODE) for a problem with a quasiperiodic solution.

robertson_ode, an Octave code which sets up a system of three nonlinear stiff ordinary differential equations (ODE) characterizing an autocatalytic chemical reaction.

roessler_ode, an Octave code which defines the right hand side of the Roessler ODE system, which exhibits chaotic behavior.

rubber_band_ode, an Octave code which defines and solves a set of ordinary differential equations (ODE) describing a mass suspended by a spring and rubber band, which can exhibit chaotic behavior.

sir_ode, an Octave code which sets up the ordinary differential equations (ODE) which simulate the spread of a disease using the Susceptible/Infected/Recovered (SIR) model.

sphere_ode, an Octave code which sets up the ordinary differential equations (ODE) which model motion on the surface of a sphere.

stiff_ode, an Octave code which considers an ordinary differential equation (ODE) which is an example of a stiff ODE.

string_ode, an Octave code which simulates the behavior of a vibrating string by solving the corresponding initial boundary value problem (IBVP).

three_body_ode, an Octave code which simulates the behavior of three planets, constrained to lie in a plane, and moving under the influence of gravity, by Walter Gander and Jiri Hrebicek.

two_body_ode, an Octave code which simulates the behavior of two bodies, constrained to lie in a plane, moving under the influence of gravity, with one body much more massive than the other.

zombie_ode, an Octave code which sets up a system of ordinary differential equations (ODE)s for a generalized SIR infection model to simulate a zombie attack, developed by Philip Munz.

Reference:

  1. George Lindfield, John Penny,
    Numerical Methods Using MATLAB,
    Second Edition,
    Prentice Hall, 1999,
    ISBN: 0-13-012641-1,
    LC: QA297.P45.

Source Code:


Last revised on 29 October 2020.