Page - 98 - in Programming for Computations β Python - A Gentle Introduction to Numerical Simulations with Python
Image of the Page - 98 -
Text of the Page - 98 -
98 4 SolvingOrdinaryDifferentialEquations
condition. Numerically,wemore literally need an initial condition: weneed to
knowa starting value at the left endof the interval in order to get the computa-
tional formulagoing.
In fact,wedonotneedacomputer sincewesee a repetitivepatternwhendoing
handcalculations,which leadsus toamathematical formula forN..kC1/ t/, :
N..kC1/ t/DN.k t/C trN.k t/DN.k t/.1C tr/
DN..k 1/ t/.1C tr/2
:::
DN0.1C tr/kC1 :
Rather thanusing (4.2) as a computationalmodel directly, there is a strong tra-
dition forderivingadifferential equation fromthisdifferenceequation. The idea is
to consider a very small time interval t and look at the instantaneous growth as
this time interval is shrunk to an infinitesimally small size. Inmathematical terms,
itmeans thatwe let t ! 0. As (4.2) stands, letting t ! 0will just producean
equation0D0, sowehave todivideby t and then take the limit:
lim
t!0 N.tC t/ N.t/
t D rN.t/:
The termon the left-hand side is actually the definition of the derivativeN 0.t/, so
wehave
N 0.t/D rN.t/;
which is thecorrespondingdifferential equation.
There is nothing in our derivation that forces the parameter r to be constant β
it can changewith timedue to, e.g., seasonal changesormorepermanent environ-
mental changes.
Detour:Exactmathematicalsolution
If you have taken a course onmathematical solution methods for differential
equations,youmaywanttorecaphowanequationlikeN 0 D rN orN 0 D r.t/N
is solved.Themethodof separationofvariables is themostconvenientsolution
strategy in this case:
N 0 D rN
dN
dt D rN
dN
N D rdt
NZ
N0 dN
N D tZ
0 rdt
back to the
book Programming for Computations β Python - A Gentle Introduction to Numerical Simulations with Python"
Programming for Computations β Python
A Gentle Introduction to Numerical Simulations with Python
- Title
- Programming for Computations β Python
- Subtitle
- A Gentle Introduction to Numerical Simulations with Python
- Authors
- Svein Linge
- Hans Petter Langtangen
- Publisher
- Springer Open
- Date
- 2016
- Language
- English
- License
- CC BY-NC 4.0
- ISBN
- 978-3-319-32428-9
- Size
- 17.8 x 25.4 cm
- Pages
- 248
- Keywords
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Category
- Informatik