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.
Define a utility function for visualizing solutions.

## Explicit Euler

Use the explicit or forward Euler method to solve the system (6).
 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 in a clockwise direction.
 Out[23]=

## Projection

Projection of the forward Euler method using the invariant (8) of the Lotka-Volterra equations gives a periodic solution.
 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.

### 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).
The numerical solution using the symplectic Euler method is periodic.
 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.

 Out[34]=
 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.
The numerical solution using the splitting method is periodic.
 Out[38]=

## Tutorial CollectionTutorial Collection

New to Mathematica? Find your learning path »
Have a question? Ask support »