## 3.4 Predator-prey model

The dynamical system is given by the following set of first-order differential equations, one represents changes in a population of predators, (e.g., **F**oxes: \(f_F(R_t,F_t)\) ), the other represents changes in a population of prey, (e.g., **R**abbits: \(f_R(R_t,F_t)\) ).

This is not a *difference* equation but a *differential* equation, which means building this system is not as straightforward as was the case in the previous assignments. Simulation requires a numerical method to ‘solve’ this differential equation for time, which means we need a method to approach, or estimate continuous time in discrete time. Below you will receive a speed course in one of the simplest numerical procedures for integrating differential equations, the Euler method.

### 3.4.1 Euler Method

A general differential equation is given by:

\[\begin{equation} \frac{dx}{dt} = f(x) \tag{3.3} \end{equation}\]Read it as saying: “*a change in \(x\) over a change in time is a function of \(x\) itself*”. This can be approximated by considering the change to be over some constant, small time step \(\Delta\):

After rearranging the terms a more familiar form reveals itself:

\[\begin{align} x_{t+1} &= x_t &= f(x_t) * \Delta \\ x_{t+1} &= f(x_t) * \Delta + x_t \tag{3.5} \end{align}\]This looks like an ordinary iterative process, \(\Delta\) the *time constant* determines the size of time step taken at every successive iteration. For a 2D system with variables **R** and **F** on would write:

### 3.4.2 Coupled System in a spreadsheet

Implement the model in a spreadsheet by substituting \(f_R(R_t,Ft)\) and \(f_F(R_t,F_t)\) by the differential equations for Foxes and Rabbits given above.

- Start with \(a = d = 1\) and \(b = c = 2\) and the initial conditions \(R_0 = 0.1\) and \(F_0 = 0.1\). Use a time constant of \(0.01\) and make at least \(1000\) iterations.
- Visualize the dynamics of the system by plotting:
- \(F\) against \(R\) (i.e., the state space)
- \(R\) and \(F\) against time (i.e., the timeseries) in one plot.

- Starting from the initial predator and prey population represented by the point \((R, F) = (0.1, 0.1)\), how do the populations evolve over time?
- Try to get a grip on the role of the time constant by increasing and decreasing it slightly (e.g. \(\Delta = 0.015\)) for fixed parameter values. (You might have to add some more iterations to complete the plot). What happens to the plot?
- Hint: Remember that \(\Delta\) is not a fundamental part of the dynamics, but that it is only introduced by the numerical integration (i.e., the approximation) of the differential equation. It should not change the dynamics of the system, but it has an effect nonetheless.