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

Page - 99 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Image of the Page - 99 -

Image of the Page - 99 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Text of the Page - 99 -

4.1 PopulationGrowth 99 lnN lnN0 D tZ 0 r.t/dt N DN0exp 0 @ tZ 0 r.t/dt 1 A; which forconstant r results inN DN0ert. Note that exp.t/ is the sameaset. Aswillbedescribed later,rmust inmorerealisticmodelsdependonN . The method of separation of variables then requires to integrate RN N0 N=r.N/dN , which quicklybecomesnon-trivial formanychoices of r.N/. The only gener- ally applicable solutionapproach is thereforeanumericalmethod. 4.1.2 NumericalSolution There is a huge collection of numerical methods for problems like (4.2), and in generalanyequationof the formu0 Df.u;t/,whereu.t/ is theunknownfunction in theproblem,andf is someknownformulaofu andoptionally t. For example, f.u;t/D ru in(4.2).Wewillfirstpresentasimplefinitedifferencemethod solving u0 Df.u;t/. The idea is four-fold: 1. IntroduceameshintimewithNtC1points t0;t1;: : :;tNt .Weseektheunknown u at the mesh points tn, and introduce un as the numerical approximation to u.tn/, seeFig. 4.1. 2. Assume that thedifferential equation isvalidat themeshpoints. 3. Approximatederivativesbyfinitedifferences, seeFig.4.2. 4. Formulateacomputationalalgorithmthatcancomputeanewvalueunbasedon previouslycomputedvaluesui, i <n. An example will illustrate the steps. First, we introduce the mesh, and very often themesh isuniform, meaning that the spacing between points tn and tnC1 is constant. Thisproperty implies that tn Dn t; nD0;1;:: :;Nt : Second, thedifferential equation is supposed tohold at themeshpoints. Note that this is an approximation, because the differential equation is originally valid at all realvaluesof t.Wecanexpress thispropertymathematically as u0.tn/Df.un;tn/; nD0;1;:: :;Nt : Forexample,withourmodel equationu0 D ru,wehave the special case u0.tn/D run; nD0;1;:: :;Nt; or u0.tn/D r.tn/un; nD0;1;:: :;Nt; if r dependsexplicitlyon t.
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
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python