16
Elements of Mathematics: an embarrasignly simple (but practical) introduction to ordinary differential equations Jordi Vill`a i Freixa ([email protected]) November 23, 2011 Contents 1 A first example 2 2 Logistic growth 3 3 Equilibrium in ODEs 5 4 The spruce budworm case 6 4.1 Adimensionalization .................................... 7 4.2 Steady state analysis .................................... 8 5 Oscillations and delays 9 5.1 Delay differential equations (DDEs) ........................... 9 5.2 A simple oscillatory system ................................ 11 5.3 Delayed logistic model ................................... 12 6 Predator-prey model 12 6.1 Phase curves ........................................ 13 6.2 Jacobian matrix ...................................... 14 7 Numerical integration 15 1

Ed 1011

Embed Size (px)

DESCRIPTION

an embarrasingly simple intro to differential equations

Citation preview

Page 1: Ed 1011

Elements of Mathematics: an embarrasignly simple (but

practical) introduction to ordinary differential equations

Jordi Villa i Freixa ([email protected])

November 23, 2011

Contents

1 A first example 2

2 Logistic growth 3

3 Equilibrium in ODEs 5

4 The spruce budworm case 6

4.1 Adimensionalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4.2 Steady state analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

5 Oscillations and delays 9

5.1 Delay differential equations (DDEs) . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

5.2 A simple oscillatory system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.3 Delayed logistic model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

6 Predator-prey model 12

6.1 Phase curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

6.2 Jacobian matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

7 Numerical integration 15

1

Page 2: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 1: a) Different possibilities for N(t) = N0e(b−d)t depending on the birth/death relationship;

b) Comparison of human world population and N(t) = N0e(b−d)t for b− d = 0.0075

8 Sources of information 16

Check also [1, 2].

Nota de classe

recollir nous exemples del llibre de l’Alon

1 A first example

Let us take N(t) as the function determining the population of a species at time t. We can expressits variation as:

dN

dt= births− deaths + migrations (1)

We typically call this expression population conservation equation.

In a Malthussian model we assume there are no migrations and that the rate of increase anddecrease of the population is proportional to the population itself:

dN

dt= bN − dN

with b and d beint constant and positive with initial population being N0. We can show that afunction that fullfils this expression is (see Figure 1a):

N(t) = N0e(b−d)t

. Figure 1b shows how such a model is not far from what really occurs.

DEs 2

Page 3: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 2: Data from WHO

Nota de classe

afegir algun altre exemple biolgic a la primera part

However, things are not that easy. Figure 2 shows the number of countries with less that 2.1kids per woman on average. This is of course just one of the many factors affecting the form of Eq.1. So, we need to add extra complexity to the problem.

2 Logistic growth

It is clear that it is necessary to find a better representation of the function f(N) in

dN

dt= f(N)

Following Taylor’s approximation up to second order (n = 2) close to f(0) we find, consideringf(0) = 0:

f(N) ≈ P2(N) = f(0)︸︷︷︸=0

+ f ′(0)N︸ ︷︷ ︸lineal term

+f ′′(0)

2N2︸ ︷︷ ︸

quadratic term

The linear term is:f(N) ≈ f ′(0)N = rN

where we have called r the constant f ′(0), and, thus, r is the intrinsic growth rate, as we saw before.On the other hand, the quadratic term can be written as:

f(N) ≈ f ′(0)N +f ′′(0)

2N2 = f ′(0)N

[1 +

f ′′(0)

2f ′(0)N

]

DEs 3

Page 4: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

dNdt = f(N)

dNdt = bN − dN → N(t) = N0e

(b−d)t

dNdt = rN

(1− N

K

)→ N(t) = N0Ke

rt

K+N0(ert−1)

Figure 3: Summary of the exponential and logistic curves

By doing r = f ′(0) and K = − 2f ′(0)f ′′(0) we get the expression for the logistic growth of a population

(Verhulst, 1838):

f(N) ≈ rN(

1− N

K

)Thus, following this model, the rate of variation of the size of a population can be expressed as

dN

dt= rN

(1− N

K

)where N = N(t) gives the size of the population at t, while r and K (hosting capacity) are positiveconstant values.

Exercise 1Show how, for a logistic curve, the inflection point is right at half the saturation value.

N(t) =N0Ke

rt

K +N0(ert − 1)

Exercise 2A population is characterized by a modified logistic curve that includes the effect of a constant

withdraw of individuals:dX

dt= rX

(1− X

K

)− a

Find the equilibrium points. What is the maximum value of a to ensure a viable population?

Nota de classe

The function f(X) is a parabola that is displaced down a units. Thus, the equilibrium pointsare found by

rX

(1− X

K

)− a = 0

rX − rX2/K − a = 0

X =−r ±

√r2 − 4ra/K

2r/K

DEs 4

Page 5: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 4: a) Shape of the logistic curve; b) equilibrium analysis of the logistic curve in a).

It is obvious that depending on the values of the argument of the square root we will have differentsituations, with a possible non viable population for a too big. In particular:

r2 − 4ra/K = 0

r(r − 4a/K) = 0

which yields that if a > rK/4 the population cannot be viable.

Figure 3 summarizes the equations for the exponential and logistic curves. What occurs ifN0 > K/2 or N0 < K/2 (See Figure 4)?

3 Equilibrium in ODEs

Equilibrium: dNdt = 0.

• N∗ = 0 unstable equilibrium, as f ′(N∗ = 0) > 0

• N∗ = K stable equilibrium, as f ′(N∗) < 0.

Exercise 3Let N(t) be the size of a population at time t. If this population evolves following a logistic curve

dN

dt= 2N

(1− N

100

)with N ≥ 0, calculate the equilibrium points and analyze their stability.

DEs 5

Page 6: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 5: The worm and its food, and how their populations are linked

Exercise 4In sexually reproductive species, individuals may experience a rate of recruiting that is too low whenthe population density exceeds a given level. This phenomena is known as Allee effect. Extendingthe logistic curve we can capture this effect:

dN

dt= rN(N − a)

(1− N

K

)where r, a and K are positive constants. Study the equilibrium states for this system for differentvalues of N0.

4 The spruce budworm case

The case of the spruce budworm C. fumiferana is one of the simplest in which we link the prey (thebudworm), its feeding habits and its predators (Figure 5) [?]. It is simple because we do not dealwith the fluctuations in the predators population, but it is a good example of the expansion of thelogistic curve. It can modelled by:

dN

dt= rB︸︷︷︸

births

N

(1− N

KB

)− p(N)︸ ︷︷ ︸

predation

DEs 6

Page 7: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

or, more precisely:

Nota de classe

Trobar cita: Ludwig proposed in 1978[?]:

dN

dt= rB︸︷︷︸

births

N

(1− N

KB

)− BN2

A2 +N2(2)

with A,B > 0 and B = βP (predating efficiency per number of birds).

• rB , the natural growth rate, as in the logistic model;

• KB , the carrying capacity, as in the logistic model;

• B = βP , being β a measure of predation efficiency. If birds are good at catching sprucebudworms, this number will be larger than if birds often miss the budworm they are attacking.P is the bird population, considered a constant in this model;

• A is called the switching value, more on this soon.

N2

A2+N2 is called a Holling Type III predation function. It measures how intensively the birds willselect spruce budworms for predation. The idea is that birds are lazy, they will go where food densityis high allowing them to consume much while expending minimal energy. If the spruce budwormdensity is low, birds will opt for some other prey which most likely lives in other parts of the trees.For example, if birds decide that beetles are abundant, they will congregate around tree trunksand branches where beetles can be found, leaving the spruce budworms unmolested. On the otherhand, once the budworm population increases the birds will leave the beetle habitat behind andbegin focusing on the easier prey, budworms in this scenario. Thus predation on budworms exhibitsthis switching phenomenon, and it is this behavior which is represented by the Hollings Type IIIfunction. The importance of the parameter A, known as the switching value, is that when N = Athe value of the Type III predation function is exactly one-half. This indicates the population atwhich predators begin showing increased interest in harvesting budworms.1

4.1 Adimensionalization

When one adimensionalizes a given equation does precisely that: eliminates the units by choosingappropriate substitutions for the original variables. A possible adimensionalization for the budwormproblem would be:

u =N

A, r =

ArBB

, q =KB

A, τ =

Bt

Awhich transforms Equation 2 into:

du

dτ= ru

(1− u

q

)− u2

1 + u2= f(u; r, q)

. This is beneficial for the analysis of the equation

1See more on this at http://www.stolaf.edu/people/mckelvey/envision.dir/spruce.html

DEs 7

Page 8: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 6: The analysis of the expression h(u) = g(u) for the adimensional budworm equations yields1 to 3 stationary points while varying r leaving q constant.

Figure 7: Different values for r and q may produce histeresis.

4.2 Steady state analysis

du

dτ= ru

(1− u

q

)− u2

1 + u2= f(u; r, q) = 0

Solutions:

• u = 0

• h(u) = r(

1− uq

)= u

1+u2 = g(u)

The second solution can be analyzed in graphical form, if we think in the problem h(u) = g(u). Fig-ures 6 shows such analysis. Check also http://www.aw-bc.com/ide/idefiles/media/JavaTools/

wormtime.html.

This system presents bifurcation points. To understand the meaning of the different regions in7, check http://www.aw-bc.com/ide/idefiles/media/JavaTools/wormkr.html.

DEs 8

Page 9: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Nota de classe

repassar el concepte d’histresi en EDs

Exercise 5Let us assume that the population of a given fish species follows a logistic curve and that we collect

a given amount of individuals per unit time following:

dN

dt= rN

(1− N

K

)−H

where we assume that r = 2 and N = 1000.

1. find the equilibrium points and analyze their stability

2. What is the maximum rate of extraction that keeps a viable size for the populaiton?

5 Oscillations and delays

Figure 8 shows an example of engineered biological oscillator. Figure 9 shows another example ofoscillatory behaviour in the differentiation of the somites during embriogenesis.

In this particular case, we can imagine a simple model in which there is just a ”feedback loop”by which a gene (Her1) generates a protein that interacts with the DNA regulatory region of thesame gene, inhibiting its own transcription:

dp

dt= am− bp

dm

dt= f(p)− cm

Can this simple system explain by itself the oscillatory behavior? In fact no if a, c > 0 (we will notdemonstrate it).

5.1 Delay differential equations (DDEs)

To introduce oscillations we could choose to incorporate more components into the model, but therea simpler way to do it. Let us assume that Tm represents the time that an mRNA molecule needsto mature and that Tp the time lapse until a given protein is functional. Then:

dp(t)

dt= am(t− Tm)− bp(t)

dm(t)

dt= f(p(t− Tp))− cm(t)

DEs 9

Page 10: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

d[PX]dt = −β(PX −X)

d[PY ]dt = −β(PY − Y )

d[PZ]dt = −β(PZ − Z)d[X]dt = −X + α

1+PZn + α0d[Y ]dt = −Y + α

1+PXn + α0d[Z]dt = −Z + α

1+PY n + α0

Figure 8: The repressilator model [3]

DEs 10

Page 11: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 9: Example of the Notch/Delta pathway induced oscillations in the development of thesomites

The above equations consider that there is a time needed to mature the system. In generalequations of the type

dN(t)

dt= f(N(t))

are transformed intodN(t)

dt= f(N(t), N(t− τ))

where τ is the delay parameter.

5.2 A simple oscillatory system

Take, for example, N(t) = A cos πt2T (with A constant). It is easy to see that such function represents

a solution fordN

dt= − π

2τN(t− τ)

So:d

dtN(t) =

d

dt

(A cos

πt

)dN

dt= −Aπ

2τsin

πt

2τ= −Aπ

2τcos

π(t− τ)

using that cos(a− b) = cos(a)cos(b)− sin(a)sin(b)

DEs 11

Page 12: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 10: Variation of the number of hares and lynx in a wild population

5.3 Delayed logistic model

Another simple example can be obtained by extending the logistic model to assume that the regu-latory term depends on the population at a previous time t− τ :

dN

dt= rN(t)

(1− N(t− τ)

K

)(3)

which needs to be solved numerically (see accompanying excel file). The result is an oscillatoryfunction. Why is that? By close inspection of Eq. 3, it is easy to see that, given t = t1 at whichN(t1) = K,

• for t < t1, N(t− τ) < K and, thus, at t = t1 the poppulation is still growing, dN/dt > 0 (notethat the logistic curve would suggest that the population would not increase anymore, as wealready reached K);

• when t = t1 + τ we reached dN/dt = 0. Is that an stable steady state?

Nota de classe

s estable? podrem fer la derivada de f(N ; τ) respecte N?

6 Predator-prey model

Ecology is more complex and two species are linked by their interactions (see Figure 10). Lotkaand Volterra (1926) proposed a pair of first order non-linear differential equations to describe thepredator (P ) prey (H) interactions:

dH

dt= rH − aHP = H(r − aP )

dP

dt= bHP −mP = P (bH −m)

It is not very realistic, but it is a good start for discussion. Thus, a qualitative study leads to Figure11.

DEs 12

Page 13: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 11: A qualitative view of the Lotka-Volterra model

Nota de classe

buscar les refs perdudes

6.1 Phase curves

Nota de classe

incloure nullclines (FitzHugh-Nagumo) i phase portrait (phase space) veure apunts la carpeta demates del mster

We start by adimensionalizing the L-V expression by using u(τ) = bH(t)m , v(τ) = aP (t)

r , τ = rt andα = m

r , gettingdu

dτ= u(1− v),

dv

dτ= αv(u− 1)

We can obtaindv

du= α

v(u− 1)

u(1− v)

that can be easily integrated yielding

Nota de classe

usar∫

xdxax+b = x

a −ba2 ln |ax + b| i fent que u − 1 = x i v − 1 = x per integrar cada terme de la

igualtat resultant

DEs 13

Page 14: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

Figure 12: Direction field for the Lotka-Volterra model.

αu+ v − lnuαv = K

This function has a minimum at ∂f(u,v)∂u = ∂f(u,v)

∂v = 0, where f(u, v) = αu + v − lnuαv −K. Thederivatives follow:

[∂f(u,v)∂u

]v

[∂f(u,v)∂v

]u

α− 1uαvαvu

α−1 = 0 1− 1uαvαu

α = 0u = 1 v = 1

That involves that such a minimum will exist at H(t0)∗ = mb i P (t0)∗ = r

a or, in our adimensionalizedversion: u∗ = 1 and v∗ = 1.

6.2 Jacobian matrix

One can approximate the nonlinear system near the fixed point, (x∗, y∗), by the linear system:

dx/dt = (x− x∗) ∗ fx(x∗, y∗) + (y − y∗) ∗ fy(x∗, y∗),dy/dt = (x− x∗) ∗ gx(x∗, y∗) + (y − y∗) ∗ gy(x∗, y∗).

The Jacobian matrix of the nonlinear system described by the equations:

dx

dt= f(x, y)

dy

dt= g(x, y)

is the matrix of partial derivatives of the functions f and g given by:

J(x, y) =

(fx(x, y) fy(x, y)gx(x, y) gy(x, y)

)When the Jacobian matrix is evaluated at a fixed point (x∗, y∗), the matrix of constant coefficients,J(x∗, y∗), is identified with the matrix A of linear systems. Near a fixed point (x∗, y∗), the dynamics

DEs 14

Page 15: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

of the nonlinear system are qualitatively similar to the dynamics of the linear system associated withthe J(x∗, y∗) matrix, provided the eigenvalues, µ1 and µ2, of the J matrix have non-zero real parts.

∂x = eλ1tx ; ∂y = eλ2ty

Fixed points with a J matrix such that Re(µ1, µ2) 6= 0 are called hyperbolic fixed points, as occurswith the first fixed point in the LV model. Otherwise, fixed points are non-hyperbolic fixed points,whose stabilities must be determined directly. This is what occurs with the second fixed point inthe LV model.

In general, the analysis of the trace and eigenvalues of the Jacobian matrix is a guide for theclassification of the hyperbolic fixed points of the model.2.

Nota de classe

la primera cosa que cal ampliar aqu s parlar-los del Jacobi de l’expressi. Mostrar com es calculaper a f(P,H), seguint el mateix raonament que feiem per a f(N) ms amunt.

Exercise 6Evaluate the Lotka-Volterra model, a local stability analysis at the positive equilibrium u = 1,v = 1.

7 Numerical integration

Taking the rate of change for the density of population:

dN

dt= f(N)

• Euler’s method:N(t0 + ∆t) = N(t0) + ∆t · f(N(t0))

• Runge-Kutta’s method (second order)

k = N(t0) +1

2∆t · f(N(t0))

N(t0 + ∆t) = N(t0) + ∆t · f(k))

Exercise 7Play with the companion excel file to see the effect of setting up the parameters: r = 0.04,a = 0.0005, b = 5 · 10−5 and c = 0.2 for the Lotka-Volterra model. Discuss the equilibrium points.

Numerical integration of ODEs leads to their use in the analysis of complex biochemical modelsand paves the way for sensitivity analysis or optimal experimental design[4]. The integration ofdeterministic ODEs differs from the simulation of stochastic models. See refs. [5, 6]

2see also http://www.phys.uri.edu/~gerhard/PHY520/mln73.pdf

DEs 15

Page 16: Ed 1011

MAT: 2011-31035-T1 MSc Bioinformatics for Health Sciences

8 Sources of information

• Numerical recipes: http://www.nr.com

• LTCC math departmenthttp://www.ltcconline.net/greenl/courses/204/204.htm

• SOS MATH:http://www.sosmath.com/diffeq/diffeq.html

• Miscellanea:

– http://www.maths.leeds.ac.uk/~carmen/3565/excl1.pdf

– http://faculty.ncf.edu/lkaganovskiy/LaTeX/talkmylotkaextend.pdf

• Software:

– R: http://www.r-project.org/

– Octave: http://www.octave.org/

– gnuplot http://www.gnuplot.info/

References

[1] U. Alon. An introduction to systems biology: design principles of biological circuits. CRC Press,2007.

[2] D.J. Wilkinson. Stochastic Modelling for Systems Biology. CRC Press, 2006.

[3] M. B. Elowitz and S. Leibler. A synthetic oscillatory network of transcriptional regulators.Nature, 403:335–338, 2000.

[4] A. Lopez Garcıa de Lomana, A. Gomez-Garrido, D. Sportouch, and J. Villa-Freixa. Optimalexperimental design in the modelling of pattern formation. LNCS, 5101:610–619, 2008.

[5] Daniel T. Gillespie. Stochastic simulation of chemical kinetics. Annual review of physical chem-istry, 58:35–55, xx 2007. 10.1146/annurev.physchem.58.032806.104637.

[6] Pau Rue, Jordi Villa-Freixa, and Kevin Burrage. Simulation Methods with Extended Stabilityfor Stiff Biochemical Kinetics. BMC Syst. Biol., 4:110, 2010.

DEs 16