Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Ordinary Differential Equations
Michael H. F. Wilkinson
Institute for Mathematics and Computing ScienceUniversity of Groningen
The Netherlands
December 2005
Introduction to Computational Science
Overview
What are Ordinary Differential Equations (ODEs)?
Equilibria: existence and properties.
What techniques exist to solve ODEs?
How do we draw up ODEs: A case study on Predator-Prey systems.
A variant: Delay Differential Equations (DDEs)
Introduction to Computational Science
Ordinary Differential Equations
ODEs can be used to model the behaviour of a system through time
The systems studied range from spring-mass systems to ecology and economics.
ODEs have the general form:d~x
dt= ~f(~x, t). (1)
Quite frequently, we deal with time independent ODEs, which have the form
d~x
dt= ~f(~x). (2)
The simplest form they can take are linear ODEs:
d~x
dt= A~x. (3)
with A a matrix.Introduction to Computational Science
Equilibria
Equilibria occur whered~x
dt= ~f(~x, t) = 0. (4)
Three types of equilibria occur:
Stable: the system returns to the equilibrium after small perturbation.Unstable: the system diverges from the equilibrium state after small perturbation.Neutrally Stable: the system neither diverges from, nor converges towards theequilibrium after small perturbation.
In the case of time independent ODEs we can determine the stability by localstability analysis quite easily.
In the first step, we linearize the ODE around the equilibrium.
Introduction to Computational Science
Equilibria
Let the equilibrium point be ~x0.
The ODE given byd~x
dt= ~f(~x) (5)
can be approximated by Taylor expansion.
We first introduce ~x′ = ~x− ~x0.
We then approximate (5) byd~x′
dt= J~x′ (6)
in which J is the Jacobian matrix:
J =
∂f1∂x1
· · · ∂f1∂xn... . . . ...
∂fn∂x1
· · · ∂fn∂xn
~x=~x0
(7)
Introduction to Computational Science
Equilibria
The solution to such a set of linear differential equations is just
~x′(t) =∑
ai~Eie
λit, (8)
with ~Ei the eigenvectors of J, λi the corresponding eigenvalues, and ai theamplitude of that particular eigenmode of the system.
Clearly, if all the eigenvalues have a negative real part, the system returns to theequilibrium position and the system is stable.
If one or more eigenvalues have positive real parts then it is unstable.
If none have positive and one or more zero real parts it is neutrally stable.
Introduction to Computational Science
Equilibria
To determine eigenvalues we need to solve the equation
det
∣∣∣∣∣∣∣∣∣∂f1∂x1
− λ ∂f1∂x2
· · · ∂f1∂xn
∂f2∂x1
∂f2∂x2
− λ · · · ∂f2∂xn... ... . . . ...
∂fn∂x1
∂fn∂x2
· · · ∂fn∂xn
− λ
∣∣∣∣∣∣∣∣∣~x=~x0
= 0 (9)
This yields an nth order polynomial
c0 + c1λ + c2λ2 + . . . + cnλn = 0 (10)
the roots of which are the eigenvalues.
Note that if all ci are real and have the same sign, the system is stable.
Introduction to Computational Science
Solving ODEs
Usually, we are concerned with systems which are too large for analyticaltreatment, but can be handled numerically.
Most often we are concerned with initial-value problems: given the state of thesystem at time t0, compute the state at a number of points in time tn > t0.
The simplest method is the Euler method
~x(tn+1) = ~x(tn) + h~f(~x(tn), tn) + O(h2), (11)
in which h is the time step and O(h2) indicates an error which is proportional to h2.
An improvement is the midpoint method:
~k1 = h~f(~x(tn), t) (12)
~x(tn+1) = ~x(tn) + h~f(~x(tn) + ~k1/2, tn + h/2) + O(h3) (13)
Introduction to Computational Science
Solving ODEs
Better still is the 4th order Runge-Kutta method:
~k1 = h~f(~x(tn), t) (14)
~k2 = h~f(~x(tn) + ~k1/2, tn + h/2) (15)
~k3 = h~f(~x(tn) + ~k2/2, tn + h/2) (16)
~k4 = h~f(~x(tn) + ~k3, tn + h) (17)
~x(tn+1) = ~x(tn) +~k1
6+
~k2
3+
~k3
3+
~k4
6+ O(h5) (18)
Various strategies for computing an optimal time step h exist.
Problems occur in so-called stiff ODEs.
In many cases (chemistry, biology) we need to check for zero crossings!
Introduction to Computational Science
Predator-Prey Systems
One of the best studied systems is the so-called predator-prey (or host-parasite)system.
It is fundamental to understanding food webs in ecology.
Its general form is
dx1
dt= F (x1)−G(x1, x2) (19)
dx2
dt= ηG(x1, x2)−H(x2) (20)
in which
F (x1) is the growth rate of x1,G(x1, x2) is the rate of predation of x1 by x2,η is the efficiency with which prey biomass is turned predator biomass, andH(x2) is the starvation rate of x2.
Introduction to Computational Science
Predator-Prey Systems
In its simplest form, we have the Lotka-Volterra system
dx1
dt= r1
(1− x1
K1
)x1 − fx1x2 (21)
dx2
dt= ηfx1x2 − d2x2 (22)
in which
f determines the rate at which predator and prey encounter eachother,r1 is the maximum relative growth rate of x1,K1 is the carrying capacity of the ecosystem for x1, andd2 is the starvation rate of x2.
This system can be stable, neutrally stable, or unstable, depending on theparameters.
Introduction to Computational Science
Predator-Prey Systems
Other models for F include the Monod-model for bacteria
F (x1, S) = µmaxS
KS + Sx1 (23)
in which S is the substrate (food) concentration, µmax the maximum growth rate,and KS a saturation constant.
Other models for G include:
Holling Type II f x1K2+x1
x2 same as Monod
Holling Type III fx2
1
K2+x21x2 for vertebrates
Jost fx2
1
K2+k2x1+x21x2 similar to above
Ivlev f(1− e−kx1)x2
All these models try to limit maximum growth in some way.
Introduction to Computational Science
A Bacterial Predator-Prey System
Suppose we have a bacterium X1 using resource X0, and which is preyed upon bypredator Y .
We assume that these species are present in a chemostat-like environment, inwhich all substances are well mixed, and which has a dilution rate D.
Food (X0) enters at a concentration S.
Uptake of food by X1 is modelled using the Monod-form.
Uptake of X1 by Y is modelled using the Holling-type-II form.
Starvation of Y takes the usual form, with dy the starvation rate.
Introduction to Computational Science
A Bacterial Predator-Prey System
The differential equations for this model are
dX0
dt= D(S −X0)− V1
X0
K1 + X0X1 (24)
dX1
dt= µ1
X0
K1 + X0X1 − Vy
X1
KX + X1Y −DX1 (25)
dY
dt= µy
X1
KX + X1Y − (D + dy)Y (26)
with Vx and µx maximum uptake and growth rates respectively, and Kx saturationconstants.
Introduction to Computational Science
A Bacterial Predator-Prey System
This system can be in four phases
Phase 0: Insufficient food is available to allow survival of X1; stable equilibrium:X0 = S, X1 = 0, and Y = 0.
Phase I: Sufficient food for survival of X1, but insufficient number survive to allowsurvival of Y .
Phase II: Both X1 and Y coexist stably.
Phase III: unstable coexistence of X1 and Y .
Important question: which parameters determine outcome?
Introduction to Computational Science
A Bacterial Predator-Prey System
The equilibrium with all species present is given by
X0 =12
(S −K1 −
V1KX
µy −D − dy±
√(S −K1 −
V1KX
µy −D − dy
)2
+ 4K1S
)(27)
X1 =D + dy
µy −D − dy(28)
Y =D
D + dy
µy
Vy
(µ1
V1(S −X0)−X1
)(29)
Only if all three solutions are positive do we have either a phase II or phase IIIsystem.
The boundary between these phases II and III is determined by local stabilityanalysis.
Introduction to Computational Science
A Bacterial Predator-Prey System
The dynamical behaviour of the predator prey system after introduction of predator
0 48 96 144 192 240 2880
10
20
30
40
50
60
70
80
time (h)
Bio
mas
s (m
g/l)
Prey Predator
0 48 96 144 192 240 2880
10
20
30
40
50
60
70
80
time (h)
Bio
mas
s (m
g/l)
Prey Predator
Introduction to Computational Science
A Bacterial Predator-Prey System
The boundaries of the phases
0 40 80 120 160 200 240 2800
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
S (mg/l)
D (
h−1 )
I
II
III
0 40 80 120 160 200 240 2800
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
S (mg/l)
D (
h−1 )
I
II
III
Introduction to Computational Science
Decoys in Predator-Prey Systems
In a simple complication, we can add a third species X2, which does not competewith X1 but can collide with the predator.
Assume that the predator can be in three states: free, bound to X1 and bound toX2.
We can then draw up the following set of differential equations:
d[X1Y ]dt
= −k1[X1Y ] + rX1Yfree (30)
d[X2Y ]dt
= −k2[X2Y ] + rX2Yfree (31)
dYfree
dt= (yx + 1)k1[X1Y ] + k2[X2Y ]− r(X1 + X2)Yfree (32)
Introduction to Computational Science
Decoys in Predator-Prey Systems
We will assume that these reactions take place at a much faster rate than thepredator prey dynamics
We can then in quasi-steady state analysis say that
k1[X1Y ] = rX1Yfree and k2[X2Y ] = rX2Yfree (33)
Adding all versions of Y together yields
dY
dt=
yxk1X1Y
k1/r + X1 + k1X2/k2=
µyX1Y
KX + X1 + KinhX2(34)
Thus the presence of X2 leads to an increase in the apparent saturation constantK∗
X = KX + KinhX2.
Introduction to Computational Science
Decoys in Predator-Prey Systems
The dynamical behaviour of the predator prey system after introduction of predatorwith decoys: K∗
X = 2KX
0 48 96 144 192 240 2880
10
20
30
40
50
60
70
80
time (h)
Bio
mas
s (m
g/l)
Prey Predator
0 48 96 144 192 240 2880
10
20
30
40
50
60
70
80
time (h)
Bio
mas
s (m
g/l)
Prey Predator
Introduction to Computational Science
Decoys in Predator-Prey Systems
The boundaries of the phases with decoys: K∗X = 2KX
0 40 80 120 160 200 240 2800
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
S (mg/l)
D (
h−1 )
I
II
III
0 40 80 120 160 200 240 2800
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
S (mg/l)
D (
h−1 )
I
II
III
Introduction to Computational Science
Delay Differential Equations (DDEs)
In ODEs the time evolution depends only on the current state of the system
In DDEs the time evolution of the system depends on the current state, plus thestate of the system at one or more points some time in the past.
This type of equation is useful to model systems in which there are time delaysbetween cause and effect.
Examples are:
incubation times of infections in models of epidemics,delay times between penetration of host by parasites and emergence of the newparasite generationdelay between mating and birth,etc.
Introduction to Computational Science
Delay Differential Equations (DDEs)
DDEs have the general form:
d~x
dt= ~f(~x(t), ~x(t− τ1), ~x(t− τ2), . . . , ~x(t− τN)). (35)
with τ1, τ2, . . . , τN the set of delays in the system.
The stability condition becomes
~f(~x(t), ~x(t), ~x(t), . . . , ~x(t)) = 0. (36)
Finding equilibria is easy, analysis of their properties generally done numerically.
Numerical treatment requires different techniques than for ODEs.
Initial value problems require information about the past for initialization!
Introduction to Computational Science
Example DDE
we use the bacterial predator-prey model as before, but use a delay equation tomodel the predator behaviour.
The prey is converted to infected prey [X1Y ] as in the decoy model
After a time delay τ the new generation of predators is released.
The differential equations for this model are
dX0
dt= D(S −X0)− V1
X0
K1 + X0X1 (37)
dX1
dt= µ1
X0
K1 + X0X1 − rX1Y −DX1 (38)
d[X1Y ]dt
= −e−DτrX ′1Y
′ + rX1Y −D[X1Y ] (39)
dY
dt= e−Dτ(yx + 1)rX ′
1Y′ − (D + dy)Y (40)
in which X ′1 and Y ′ denote the concentrations of X1 and Y at t− τ .
Introduction to Computational Science
Example DDE
The delay effect can sometimes be approaximated by an average rate of formationof new prey, leading to a Holling type II version as in the original bacterialpredator-prey model.
0 50 100 150 200 250 30010
2
103
104
105
106
107
108
time (h)
dens
ity (
cm−
3 )
0 50 100 150 200 250 30010
2
103
104
105
106
107
108
time (h)
dens
ity (
cm−
3 )
(a) (b)
Part (a) shows the DDE appraoch, part (b) the ODE approximation.Introduction to Computational Science