Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Page - 213 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 213 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 213 -

Image of the Page - 213 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 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.
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python 3.6
Volume
Second Edition
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2020
Language
English
License
CC BY 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
356
Keywords
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Category
Informatik
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python