Lecture 8: Bean-bag modelling with interactions



Prelude

Mass-action

Take a look at Huffaker's mite experiment, as see their observations for the numbers of prey mites and predator mites over time. Can we describe and explain Huffaker's observations with a model?

\[\begin{matrix} \frac{dN}{d t} = - c N P + r N \\ \frac{dP}{d t} = c N P - d P\end{matrix}\]

Now, here is a python script showing how to calculate time-series solutions based on the Lotka--Volterra predator-prey differential equations we derived in class.

[Show code]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python2

from scipy import array, linspace
from scipy import integrate
from matplotlib.pyplot import *

# Parameters for our predator-prey differential equations
r = 1. # net density-independent growth rate of prey population
c = 2.
d = 1.

def vector_field(X, t):
    # The differenti equations are
    #
    #    dN
    #    -- = -c N P + r N
    #    dt
    #
    #    dP
    #    -- = c N P - d P
    #    dt
    N = X[0] # prey density
    P = X[1] # predator density
    return array([r*N - c*N*P,   c*N*P - d*P])

# set up our initial conditions
N0 = 1.
P0 = 1.
X0 = array([N0, P0])

# choose the time's we'd like to know the approximate solution
t = linspace(0., 20., 100)
X = integrate.odeint(vector_field, X0, t)

# plot our solutions
figure(1)
subplot(2,1,1) # a time-series plot
plot(t, X[:,0], 'bx-', linewidth=2)
plot(t, X[:,1], 'g+-', linewidth=2)
legend(['Prey', 'Predator'])

subplot(2,1,2) # a phase-space plot
plot(X[:,0], X[:,1], 'k-')

savefig('predatorprey.pdf')
savefig('predatorprey.png')
show()