Skip to main content

Scientific Computing

Essential Maths

Systems of di... []

Scientific Computing

Essential Maths

Systems of di... []

This material has been adapted from material by Fergus Cooper from the "Essential Mathematics" module of the SABS R³ Center for Doctoral Training.

This material has been adapted from material by Fergus Cooper from the "Essential Mathematics" module of the SABS R³ Center for Doctoral Training.

Creative Commons License
This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

Creative Commons License

Systems of differential equations 2

System Simplification


YouTube lecture recording from October 2020

The following YouTube video was recorded for the 2020 iteration of the course. The material is still very similar:

Youtube lecture thumbnail


Recap

  • So far we have looked at systems of first order, linear ODEs in two dimensions

  • These systems can be solved analytically

    • 3 methods of solving systems of first order ODEs

    • Diagonalisation extends to NN-dimensional systems

Plan

  • Aim to look at systems of first order, nonlinear ODEs in more dimensions

  • How we go about modelling a problem

  • Simplifying systems of ODEs

    • Reducing number of parameters

    • Reducing number of equations

  • Phase plane analysis

System simplification: rescaling

This predator-prey model is in dimensional terms and contains 5 parameters.

dNdT=rN(1NK)bNP,dPdT=ebNPmP.\begin{align*} \frac{{\rm d}N}{{\rm d}T} &= rN\left(1-\frac{N}{K}\right) - bNP,\\ \frac{{\rm d}P}{{\rm d}T} &= ebNP - mP. \end{align*}
  • rr: prey intrinsic growth rate

  • KK: prey carrying capacity (bound to logistic growth)

  • bb: predation rate

  • ee: conversion efficiency

  • mm: per capita predator mortality rate

If we substitute

  • N=θnN=\theta{n}

  • P=ϕpP=\phi{p}

  • T=τtT=\tau{t}

where n,p,tn,p,t are nondimensional, and θ\theta, ϕ\phi and τ\tau is a typical values for NN, PP and TT.

Note that, when we are re-scaling time:

ddT=ddtdtdT=1τddt.\displaystyle \frac{{\rm d}}{{\rm d}T} = \frac{{\rm d}}{{\rm d}t}\frac{{\rm d}t}{{\rm d}T} = \frac{1}{\tau} \frac{{\rm d}}{{\rm d}t}.

The original equations are:

dNdT=rN(1NK)bNP,dPdT=ebNPmP.\begin{align*} \frac{{\rm dN}}{{\rm dT}} &= rN\left(1-\frac{N}{K}\right) - bNP,\\ \frac{{\rm dP}}{{\rm dT}} &= ebNP - mP. \end{align*}

And, after rescaling, we have:

θτdndt=θrn(1θnK)bnpθϕ,ϕτdpdt=ebnpθϕmpϕ.\begin{align*} \frac{\theta}{\tau}\frac{{\rm d}n}{{\rm d}t} &= {\theta}rn\left(1-\frac{{\theta}n}{K}\right) - bnp{\theta}{\phi},\\ \frac{\phi}{\tau}\frac{{\rm d}p}{{\rm d}t} &= ebnp{\theta}{\phi} - mp{\phi}. \end{align*}

Note that θ\theta, ϕ\phi and τ\tau are arbitrary values for scaling NN, PP, and TT.

dndt=τ(rn(1θnK)bnpϕ),dpdt=τ(ebnpθmp).\begin{align*} \frac{{\rm d}n}{{\rm d}t} &= \tau\left( rn\left(1-\frac{{\theta}n}{K}\right) - bnp{\phi}\right),\\ \frac{{\rm d}p}{{\rm d}t} &= \tau\left( ebnp{\theta} - mp\right). \end{align*}

After rearranging we note that choosing θ=K\theta=K will remove the parameter KK from the equations.

Choosing τ=1/m\tau = 1/m (or τ=1/r\tau =1/r) will remove a further parameter.

n˙=(rmn(1n)bϕmnp),p˙=(ebpKmnp).\begin{align*} \dot{n} &= \left( \frac{r}{m}n(1-n) - \frac{b{\phi}}{m}np\right),\\ \dot{p} &= \left( \frac{ebpK}{m}n - p\right). \end{align*}

ϕ=m/b\phi=m/b gives the two parameter system:

n˙=(rmn(1n)np),p˙=(ebpKmnp),\begin{align*} \dot{n} &= \left( \frac{r}{m}n(1-n) - np\right),\\ \dot{p} &= \left( \frac{ebpK}{m}n - p\right), \end{align*}

where we have shifted the groups of parameters to only two places.

We could make it more obvious that there are only two "tuning dials" by writing it as:

n˙=v1n(1n)np,p˙=p(v2n1),\begin{align*} \dot{n} &= v_1 n(1-n) - np,\\ \dot{p} &= p(v_2 n - 1), \end{align*}

System simplification: conservation

Consider a chemical system where a product is formed from a substrate via an intermediate complex involving an enzyme.

S+Ek1k1Ck2P+E\displaystyle S + E \overset{k_1}{\underset{k_{-1}}\rightleftharpoons} C \overset{k_2}\rightarrow P + E

This system can be written as a system of 4 ODEs for s,e,c,ps, e, c, p which describe the concentrations of S,E,CS, E, C and PP:

s˙=k1se+k1c,e˙=k1se+k1c+k2c,c˙=k1sek1ck2c,p˙=k2c.\begin{align*} \dot{s} &= -k_1 se + k_{-1}c, \\ \dot{e} &= -k_1 se + k_{-1}c + k_{2}c,\\ \dot{c} &= k_1 se - k_{-1}c - k_{2}c, \\ \dot{p} &= k_{2}c. \end{align*}

However, the enzyme is recycled: it is used in the complex and then released. This means that e+c=etote + c = e_{tot} where etote_{tot} is constant.

Making the substitution e=etotce = e_{tot} - c to eliminate ee we arrive at the 3 ODE system:

s˙=k1s(etotc)+k1c,c˙=k1s(etotc)k1ck2c,p˙=k2c.\begin{align*} \dot{s} &= -k_1 s(e_{tot} - c) + k_{-1}c, \\ \dot{c} &= k_1 s(e_{tot} - c) - k_{-1}c - k_{2}c,\\ \dot{p} &= k_{2}c. \end{align*}

System simplification: quasi-steady state

In the previous example it may be known that the rate of conversion to complex (from k1k_1 and k1k_{-1}) is much faster than the degradation of complex into product (rate k2k_2).

If this is the case then we can assume that the concentration of CC arrives at some level cc^* (a quasi-steady state) and then moves very slowly.

Solving for c˙=0\dot{c}=0:

c˙=k1s(etotc)k1ck2c=0,    c=k1etotsk1+k2+k1s,\begin{align*} \dot{c} &= k_1 s(e_{tot} - c) - k_{-1}c - k_{2}c = 0, \\ \implies c^*&=\frac{k_1 e_{tot} s}{k_{-1} + k_2 + k_1 s}, \end{align*}

which is not a steady-state: it moves slowly with ss.

Substituting this quasi-steady state into the remaining equations gives an approximate system of 2 ODEs:

s˙=k1k2etotsk1+k2+k1s,p˙=k1k2etotsk1+k2+k1s.\begin{align*} \dot{s} &= -\frac{k_1 k_2 e_{tot} s}{ k_{-1} + k_2 + k_1 s}, \\ \dot{p} &= \frac{k_1 k_2 e_{tot} s}{ k_{-1} + k_2 + k_1 s}. \end{align*}

This means that we have used conservation and quasi-steady state to go from a 4-dimensional system (s,e,c,p)(s,e,c,p) to a two-dimensional approximation which captures some of the behaviour.

Two dimensions are good because we can plot their behaviour on a phase plane diagram.

Phase planes and nullclines

A system of nonlinear ODEs may have more than one fixed point (or may have none). Finding fixed points in two-dimensional systems is aided by nullclines.

An xx-nullcline is a line where x˙=0\dot{x}=0 and a yy-nullcline is a line where y˙=0\dot{y}=0. (These are straight lines in the linear case.)

For example:

x˙=x(1x)xy,y˙=2y(1y2)3xy,\begin{align*} \dot{x} &= x(1-x) -xy,\\ \dot{y} &= 2y\left(1-\frac{y}{2}\right) - 3xy, \end{align*}

has xx-nullclines at x=0x=0 and 1xy=01-x-y=0; and yy-nullclines at y=0y=0 and 23xy=02-3x-y=0.

Nullcline intersections give us the fixed points. Nullclines can be annotated to give the direction (and magnitude) of the non-zero derivative.

Plot of the nullclines

Plot of the nullclines of the ODE system

Plot of the phase plane

Plot of the phase plane of the ODE system

The nullclines allow us to add arrows demonstrating the flow direction, and by following the arrows we can sketch the behaviour of solutions (green lines). The arrows can only cross the xx-nullclines vertically, and the yy-nullclines horizontally.

Python code to plot the phase plane

import numpy as np from matplotlib import pyplot as plt import scipy def dX_dt(X, t): return np.array([ X[0]*(1. - X[0]) - X[0]*X[1], 2.*X[1]*(1.-X[1]/2.) -3*X[0]*X[1]]) def plot_phase_plane(): plt.figure(figsize=(10,10)) init_x = [1.05, 0.9, 0.7, 0.5, 0.5, 0.32, 0.1] init_y = [1.0, 1.3, 1.6, 1.8, 0.2, 0.2, 0.2] plt.plot(init_x, init_y, 'g*', markersize=20) for v in zip(init_x,init_y): X0 = v # starting point X = scipy.integrate.odeint( dX_dt, X0, np.linspace(0,10,100)) plt.plot( X[:,0], X[:,1], lw=3, color='green') # plot nullclines x = np.linspace(-0.1,1.1,24) y = np.linspace(-0.1,2.1,24) plt.hlines(0,-1,15, color='#F39200', lw=4, label='y-nullcline 1') plt.plot(x,1 - x, color='#0072bd', lw=4, label='x-nullcline 2') plt.vlines(0,-1,15, color='#0072bd', lw=4, label='x-nullcline 1') plt.plot(x,2 - 3*x, color='#F39200', lw=4, label='y-nullcline 2') # quiverplot - define a grid and compute direction at each point X, Y = np.meshgrid(x, y) # create a grid DX = X*(1-X) - X*Y # evaluate dx/dt DY = 2*Y*(1 - Y/2.0) - 3*X*Y # evaluate dy/dt M = (np.hypot(DX, DY)) # norm growth rate M[ M == 0] = 1. # avoid zero division errors plt.quiver(X, Y, DX/M, DY/M, M) plt.xlim(-0.05,1.1) plt.ylim(-0.05,2.1) plt.xlabel('x') plt.ylabel('y')

Summary

  • Simplification

    • Rescaling to dimensionless quantities

    • Conservation

    • Quasi-steady state approximation

  • Nullclines are a powerful way of finding steady states and phase flow

Introductory problems

Introductory problems 1

Find the fixed points of the following linear systems:

  1. x˙=x+3y,y˙=6x+5y;\displaystyle \dot{x} = x+3y, \qquad \dot{y}=-6x+5y;

  2. x˙=x+3y+4,y˙=6x+5y1;\displaystyle \dot{x} = x+3y+4, \qquad \dot{y}=-6x+5y-1;

  3. x˙=x+3y+1,y˙=6x+5y.\displaystyle \dot{x} = x+3y+1, \qquad \dot{y}=-6x+5y.

Introductory problems 2

Find the fixed points of the following nonlinear systems:

  1. x˙=4y+2xy8y˙=4y2x2;\displaystyle \dot{x} = -4y+2xy-8 \qquad \dot{y}=4y^2-x^2;

  2. x˙=yx2+2,y˙=2(x2y2).\displaystyle \dot{x} = y-x^2+2, \qquad \dot{y}=2(x^2-y^2).

Main problems

Main problems 1

Consider the chemical reaction network:

k0Ak1k1Bk2\displaystyle \overset{k_0}\longrightarrow A \overset{k_1}{\underset{k_{-1}}\rightleftharpoons} B \overset{k_2}\longrightarrow

  1. Write down the system of two linear ODEs which describe the evolution of the concentrations of A and B in this system under the law of mass action.

  2. Find the ratio of concentrations of A and B for which this system is in steady state: that is the concentrations do not change over time.

Main problems 2

Consider the reversible enzyme reaction:

S+Ek1k1Ck2k2P+E\displaystyle S + E \overset{k_1}{\underset{k_{-1}}\rightleftharpoons} C \overset{k_2}{\underset{k_{-2}}\rightleftharpoons} P + E

Verify the Haldane relation, which states that when the reaction is in equilibrium,

ps=k1k2k1k2,\displaystyle \frac{p}{s} = \frac{k_1 k_2}{k_{-1}k_{-2}},

where pp and ss are the concentrations of PP and SS, respectively.

Main problems 3

The population of a host, H(t)H(t), and a parasite, P(t)P(t), are described approximately by the equations:

dHdT=(abP)H,dPdT=(cdPH)P,H>0,\displaystyle \def\dd#1#2{{\frac{{\rm d}#1}{{\rm d}#2}}} \dd{H}{T}=(a-bP)H,\qquad \dd{P}{T}=(c-\frac{dP}{H})P, \qquad H>0,

where a,b,c,da,b,c,d are positive constants.

By a suitable change of scales show that these equations may be put in the simpler form

y˙=(1x)y,x˙=αx(1xy),\displaystyle \dot{y} = (1-x)y, \qquad \dot{x}=\alpha x(1-\frac{x}{y}),

where α=ca\displaystyle \alpha=\frac{c}{a}.

Sketch the phase flow across the following lines:

  1. y=x\displaystyle y=x;

  2. x=0\displaystyle x=0;

  3. y=0\displaystyle y=0;

  4. x=1\displaystyle x=1;

  5. y=βx\displaystyle y=\beta x, for β\beta greater than and less than 1.

Main problems 4

Consider a lake with some fish attractive to anglers. We wish to model the fish-angler interaction under the following assumptions:

  • the fish population grows logistically in the absence of fishing;

  • the presence of anglers depresses the fish growth rate at a rate jointly proportional to the size of the fish and angler populations;

  • anglers are attracted to the lake at a rate directly proportional to the number of fish in the lake;

  • anglers are discouraged from the lake at a rate directly proportional to the number of anglers already there.

  1. Write down a mathematical model for this situation, clearly defining your terms.

  2. Use a suitable scaling to show that a non-dimensionalised version of the model is

    x˙=rx(1x)xy,y˙=βxy\dot{x} = rx(1 - x) - xy,\qquad \dot{y} = \beta x - y