grazing_ode, a Python code which sets up and solves a pair of ordinary differential equations (ODE) that model the populations of an edible plant, and the herbivore that grazes on it.

In some ways, this problem recalls the predator-prey or Lotka-Volterra ODE, but in this case, there is a stable attracting solution, and strictly positive starting points are gradually attracted to it.


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


grazing_ode is available in a MATLAB version and an Octave version and a Python version.

Related Data and codes:

python_ode, Python codes which sets up various systems of ordinary differential equations (ODE).


  1. Michael Thompson, Bruce Stewart,
    Nonlinear Dynamics and Chaos,
    Second Edition,
    Wiley, 2002,
    ISBN: 0-471-87645-3,
    LC: QA871.T47.

Source Code:

Last revised on 09 June 2021.