Seite - 213 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 213 -
Text der Seite - 213 -
8.2 PopulationGrowth:AFirstOrderODE 213
Detour:Exactmathematical solution
If you have taken a course on mathematical solution methods for differential
equations, you may want to recap how an equation like N′ = rN orN′ =
r(t)N is solved.Themethodofseparationofvariables is themostconvenient
solutionstrategy in thiscase:
N′ = rN
dN
dt = rN
dN
N = rdt
∫ N
N0 dN
N = ∫ t
0 rdt
lnN− lnN0 = ∫ t
0 r(t)dt
N =N0exp( ∫ t
0 r(t)dt),
whichforconstantr results inN =N0ert.Note thatexp(t) is thesameaset.
As will be described later, r must in more realistic models depend
on N. The method of separation of variables then requires to
integrate∫N
N0 N/r(N)dN, which quickly becomes non-trivial for many choices of
r(N). The onlygenerallyapplicable solution approach is thereforea numeri-
calmethod.
8.2.2 NumericalSolution:TheForwardEuler(FE)Method
There is a huge collection of numerical methods for problems like (8.1), and in
general anyequationof the formu′ =f(u,t), whereu(t) is the unknownfunction
intheproblem,andf is someknownformulaofuandoptionally t. Inourcasewith
populationgrowth, i.e., (8.1),u′(t)correspondstoN′(t),whilef(u,t)corresponds
to rN(t).
We will first present a simple finite differencemethod solvingu′ =f(u,t). The
idea is fourfold:
1. IntroduceNt+1points in time, t0,t1,.. .,tNt , for the relevant timeinterval.We
seek the unknownu at these points in time, and introduceun as the numerical
approximationtou(tn), see Fig.8.3.
2. Utilize that thedifferentialequation isvalidat themeshpoints.
3. Approximatederivativesbyfinite differences, see Fig.8.4.
4. Formulatea computationalalgorithmthatcan computea newvalueun basedon
previouslycomputedvaluesui, i <n.
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
- Titel
- Programming for Computations – Python
- Untertitel
- A Gentle Introduction to Numerical Simulations with Python 3.6
- Band
- Second Edition
- Autoren
- Svein Linge
- Hans Petter Langtangen
- Verlag
- Springer Open
- Datum
- 2020
- Sprache
- englisch
- Lizenz
- CC BY 4.0
- ISBN
- 978-3-319-32428-9
- Abmessungen
- 17.8 x 25.4 cm
- Seiten
- 356
- Schlagwörter
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Kategorie
- Informatik