Computational modeling techniques - Åbo Akademiusers.abo.fi/ipetre/compmod/Lecture_10.pdf · 2014....
Transcript of Computational modeling techniques - Åbo Akademiusers.abo.fi/ipetre/compmod/Lecture_10.pdf · 2014....
-
Computational modeling techniques
Lecture 10: Modeling with ODEs
Ion Petre Department of IT, Abo Akademi
http://users.abo.fi/ipetre/compmod/
-
Modeling with differential equations
• Modeling strategy o We model the change in the values of all variables: o Future value = present value + change o We describe the change as a function of the current values of all
variables o If the process takes place continuously in time, it leads to differential
equations
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 2
-
Modeling with differential equations
• Say that we have information about the change in a population size:
o ∆P=P(t+∆t)-P(t)=kP(t)∆t o This is a difference equation: time treated
discretely (we have a discrete set of time points)
• If the time is continuous: t varies continuously over an interval
o ∆P/∆t=kP(t) o Interpretation: average rate of change of P
during the interval (t, t+∆t) o Allow ∆t to approach 0: dP/dt=kP
– instantaneous rate of change!
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 369
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 3
-
Modeling with differential equations
• The use of differential equations
o instantaneous rate of change in continuous problems
o approximate an average rate of change in discrete problems
– useful because calculus may help to discover a functional relationship even in an essentially discrete system
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 4
-
The derivative as a rate of change
• Development of calculus was triggered by the study of motion (16th and 17th centuries)
o particle travels from s1 at time t1 to s2 at time t2 o ∆s/∆t is the average velocity during this time period (see figure below) o ds/dt(t=t1)=lim∆t0∆s/∆t
• If y=f(x) is a differentiable function, then the derivative dy/dx at any point can be interpreted as the instantaneous rate of change of y with respect to x at that point
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 370
October 1, 2014 5
-
The derivative as the slope of the tangent line
• Drive to understand the motion of planets
o in constructing lenses for telescopes there was a need of knowing the tangent to the curve describing the lens surface
o ∆s/∆t can also be interpreted as the slope of the secant from A=(t1 ,s1) to B=(t2 ,s2)
o when ∆t approaches 0 we get the slope of the line tangent to the curve s(t) at point A
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 371
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 6
-
Example: population growth
• Example: population growth (the Malthus model, 18th century)
o We know the population size P0 at time t=t0 o We want to predict the population level at some later time t1 o Consider two factors:
– birthrate rate – death rate
o Notes – Ignore immigration and emigration, living space restrictions, etc. – Birthrate: influences by many factors, including infant mortality rate,
availability of contraceptives, abortion, health care, etc. – Death rate: influences by sanitation, public health, wars, pollution, medicine,
etc. – Assume that in a small interval of time, a percentage b of the population is
newly born and a percentage c of the population dies
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 8
-
Example: population growth
• Constructing the model o We write an equation for the change in the population: dP/dt = bP(t)–
cP(t), i.e., dP/dt=(b-c)P(t) o The solution is: P(t)=P0exp((b-c)(t-t0))
• Verifying the model: numerical fit and validation
o Population of US in 1990: 248.710.000 and in 1970: 203.211.926
– Plugging in these numbers, we obtain that b-c=0.01 o Predict the population in 2000: 303.775.080
– The real population level in 2000: 281.400.000. – The model prediction is about 8% off the mark. Not too bad!
o Predict the population level in 2300: 55.209.000.000.000!!!
o Conclusion: the model is unreasonable over long periods of time
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 9
-
A refined model for population growth
• In the basic model we have assumed that the change in the population is proportional to the current population level: dP/dt = kP(t)
• Assume that k is not constant. Instead, assume that it depends on the population level
o For example: as the population increases and gets closer to a maximum level M, k decreases
o One possible (simple, linear) model for this: k=r(M-P(t)) o Our equation: dP/dt=r(M-P(t))P(t)
o Such a population model for US was proposed in 1920, with
M=197.273.522, determined based on census figures for 1790, 1850, 1910
o Verifying the model: very good predictions up to 1950, too small predictions for 1970, 1980, 1990, 2000
o Not surprising: immigration, wars, advances in medicine not considered
o Verifying the model on the growth of yeast in culture gives excellent predictions
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 10
-
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 375
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 11
-
Example: prescribing drug dosage
Problem: How can the doses and the time between doses be adjusted to maintain a safe but effective concentration of the drug in the blood?
• concentration in the blood resulting from a single does of a drug decreases with time
• giving consecutive doses – there is still a residual
concentration L when we give the next dose
– Give a dose of H-L, where H and L are highest/lowest allowed levels
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 382-383 October 1, 2014 12
-
Example (continued)
• Assumptions o assume that the body weight and the blood
volume are constants o only the concentration level of the drug is the
critical factor in determining the effect of the drug
• Submodels
o for decay rate – Assumption: decrease in the concentration is
proportional to the concentration – dC/dt(t)=-kC(t), where k is a positive constant – Solution: C(t)=C0e-kt
o for accumulation rate – assume that once a drug is given, it diffuses so
rapidly that it adds right away to the residual drug in the blood stream
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 384
13
-
Example (continued)
Drug accumulation • give a concentration of C0 at fixed time intervals
of length T • give first dose at t=0
• at time t=T we still have a residual R1=C0e-kT • the concentration will be C1=C0+C0e-kT
• at time t=2T we have a residual R2=C1e-kT= =C0e-kT+C0e-2kT
• the concentration will be C2=C0+C0e-kT +C0e-2kT
• at time t=nT we have a residual Rn=C0e-kT+C0e-2kT+…+C0e-nkT=
=C0e-kT(1+r+r2+…+rn-1), where r=e-kT • Rn=C0e-kT(1-e-nkT)/(1-e-kT)
• Note: when n tends to infinity, Rn tends to
R=C0/(e-kT-1)
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 385
14
-
Example (continued)
Determining the dose schedule • We want the level to be in between L
and H, and T to be maximal • In other words, we want R=L and
C0=H-L – The residual should not go under L – The concentration should never go
over H • But R=C0/(e-kT-1) • Thus: L=(H-L)/(e-kT-1) • T=1/k ln(H/L)
Note • To reach faster an effective level, one
may give an initial dose that is larger than C0
• Weakness: the assumption that the drug concentration rises instantaneously after giving the drug
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 387
15
-
Graphical solutions of autonomous differential equations
• Focus in this lecture only on first-order differential equations: dy/dx=g(x,y)
o in some cases, either variable x or y might not appear explicitly on the right hand side of the equation
o discuss here the solution curve: the graph of the solution y(x)
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 16
-
Graphical solutions: slope fields
• Plotting the graph of function y(x), where dy/dx=g(x,y) might be difficult – solving the ODE might be difficult
• Alternative approach: slope fields
• Assume we have an initial condition y(x0)=y0
o then the solution curve passes through point (x0,y0) and it has slope g(x0,y0) in that point
o picture these slopes graphically by drawing short line segments of slope g(x,y) at various points (x,y) – the segment will be a tangent to the curve in point (x,y)
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 17
-
Graphical solutions: slope fields
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 18
Giordano et al. A first course in mathematical modeling. (3rd edition), Page 395
-
Equilibrium points
• Similar notion as discussed earlier for difference equations
• Definition. A differential equation of the form dy/dx=g(y) is called autonomous
• If dy/dx=g(y) is an autonomous differential equation, then the values of y for which g(y)=0 are called equilibrium values
o no change in function y(x) at an equilibrium point
o Example: dy/dx=(y+1)(y-2) has two equilibrium points, -1 and 2
• Important to identify the equilibrium points and the behavior around them
o solve equation g(y)=0 and the sign of the function o also solve equation dg/dy(y)=0 and the sign of the function
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 19
-
Example
• Consider equation dy/dx=(y+1)(y-2), where y(x):ℜ→ℜ o draw the real axis for y and mark the solution of dy/dx=0 o identify the signs of (y+1)(y-2) on all intervals o This gives the monotonicity of y
• Partial conclusions
o Equilibrium points: -1 and 2
o 2 is an unstable equilibrium: – starting with y(0)>2 yields an increasing function, pushes it away from 2 – Starting with y(0)0 y’>0 y’
-
Example
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 22
-1 2
y’>0 y”0 y”>0
y’0
y
y’
-
Example
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 23
-1 2
y’>0 y”0 y”>0
y’0
y
y’0
y’0
y
y’
-
Stable and unstable equilibria
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 24
• Types of equilibrium points (informal definitions)
o Stable: starting from a nearby initial point will give an orbit that remains nearby the original orbit
– Asymptotically stable (attractor): starting from a nearby
initial point will give an orbit that converges towards the original orbit
– Example: a pendulum in the lowest position
o Unstable: starting from a nearby initial point may give an orbit that goes away from the original orbit
– Example: a pendulum in the highest position
Stable-unstable equilibrium Source for picture: Wikipedia
-
Example: limited growth model
• Model: dP/dt=r(M-P)P o Equilibria: P=M, P=0 o dP/dt>0 if 00
P
M/2
d2P/dt2
-
Example: limited growth model
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 27
0 M
dP/dt>0
d2P/dt2>0
P
M/2
d2P/dt2
-
Learning objectives
• Be able to formulate the evolution of change in terms of an ODE-based model
• Be able to identify the monotonicity and the concavity of simple ODE-based models
• Be able to identify the equilibrium points of simple ODE-base models
• Understand the concepts of stable, asymptotically stable equilibrium points
October 1, 2014 Computational modeling techniques http://users.abo.fi/ipetre/compmod/ 28
Computational modeling techniquesModeling with differential equationsModeling with differential equationsModeling with differential equationsThe derivative as a rate of changeThe derivative as the slope of the tangent lineExample: population growthExample: population growthA refined model for population growthSlide Number 11Example: prescribing drug dosageExample (continued)Example (continued)Example (continued)Graphical solutions of autonomous differential equationsGraphical solutions: slope fieldsGraphical solutions: slope fieldsEquilibrium pointsExampleExampleExampleStable and unstable equilibriaExample: limited growth modelExample: limited growth modelLearning objectives