MATHEMATICA TUTORIAL

Numerical Methods for Solving the Lotka-Volterra Equations

Introduction

The Lotka-Volterra system arises in mathematical biology and models the growth of animal species. Consider two species where denotes the number of predators and denotes the number of prey. A particular case of the Lotka-Volterra differential system is

where the dot denotes differentiation with respect to time .

The Lotka-Volterra system (1) has an invariant , which is constant for all :

The level curves of the invariant (2) are closed so that the solution is periodic. It is desirable that the numerical solution of (3) is also periodic, but this is not always the case. Note that (4) is a Poisson system:

where is defined in (5).

Poisson systems and Poisson integrators are discussed in Chapter VII.2 of [HLW02] and [MQ02].

Load a package with some predefined problems and select the Lotka-Volterra system.
In[10]:=
Click for copyable input
Define a utility function for visualizing solutions.
In[18]:=
Click for copyable input

Explicit Euler

Use the explicit or forward Euler method to solve the system (6).
In[19]:=
Click for copyable input
Out[20]=

Backward Euler

Define the backward or implicit Euler method in terms of the RadauIIA implicit Runge-Kutta method and use it to solve (7). The resulting trajectory spirals from the initial conditions toward a fixed point at (2,1) in a clockwise direction.
In[21]:=
Click for copyable input
Out[23]=

Projection

Projection of the forward Euler method using the invariant (8) of the Lotka-Volterra equations gives a periodic solution.
In[24]:=
Click for copyable input
Out[25]=

Splitting

Another approach for obtaining the correct qualitative behavior is to additively split (9) into two systems:

By appropriately solving (10) it is possible to construct Poisson integrators.

Define the equations for splitting of the Lotka-Volterra equations.
In[26]:=
Click for copyable input

Symplectic Euler

Define the symplectic Euler method in terms of a splitting method using the backward and forward Euler methods for each system in (11).
In[31]:=
Click for copyable input
The numerical solution using the symplectic Euler method is periodic.
In[33]:=
Click for copyable input
Out[33]=

Flows

Consider splitting the Lotka-Volterra equations and computing the flow (or exact solution) of each system in (12). The solutions can be found as follows, where the constants should be related to the initial conditions at each step.

In[34]:=
Click for copyable input
Out[34]=
In[35]:=
Click for copyable input
Out[35]=

An advantage of locally computing the flow is that it yields an explicit, and hence very efficient, integration procedure. The method provides a general way of computing the flow of each splitting using DSolve only during the initialization phase.

Set up a hybrid symbolic-numeric splitting method and use it to solve the Lotka-Volterra system.
In[36]:=
Click for copyable input
The numerical solution using the splitting method is periodic.
In[38]:=
Click for copyable input
Out[38]=
New to Mathematica? Find your learning path »
Have a question? Ask support »