Web-Books
im Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Seite - 216 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

Seite - 216 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Bild der Seite - 216 -

Bild der Seite - 216 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Text der Seite - 216 -

216 8 SolvingOrdinaryDifferentialEquations orwithf(u,t)= ru inourspecial modelproblemforpopulationgrowth, un+1 −un Δt = run . (8.4) If r dependson time,we insert r(tn)= rn for r in this latter equation. The fourth step is to derive a computational algorithm. Looking at (8.3), we realize that if un should be known, we can easily solve with respect to un+1 to geta formula foruat thenext time level tn+1: un+1 =un+Δtf(un,tn). (8.5) Providedwehaveaknownstartingvalue,u0 =U0,wecanuse (8.5) toadvancethe solutionbyfirst computingu1 fromu0, thenu2 fromu1,u3 fromu2, andso forth. Suchanalgorithmiscalledanumericalscheme for thedifferentialequation. It is oftenwrittencompactlyas un+1 =un+Δtf(un,tn), u0 =U0, n=0,1,.. .,Nt −1 . (8.6) This scheme isknownas the ForwardEulerscheme, alsocalledEuler’smethod. Inourspecial populationgrowthmodel,we have un+1 =un+Δtrun, u0 =U0, n=0,1,.. .,Nt −1 . (8.7) We may also write this model using the problem-specific symbolN instead of the genericu function: Nn+1 =Nn+ΔtrNn, N0 =N0, n=0,1,.. .,Nt −1 . (8.8) The observant reader will realize that (8.8) is nothing but the computational model (8.2) arising directly in the model derivation. The formula (8.8) arises, however, from a detour via a differential equation and a numerical method for the differential equation. This looks rather unnecessary! The reason why we bother to derivethedifferentialequationmodelandthendiscretizeitbyanumericalmethodis simply that the discretizationcan be done in manyways, and we can create (much) moreaccurateandmorecomputationallyefficient methods than (8.8)or (8.6).This canbeuseful inmanyproblems!Nevertheless,theForwardEulerschemeisintuitive andwidelyapplicable, at least whenΔt is chosen to besmall. The numerical solutionbetween themesh points Our numerical method computes the unknown function u at discrete mesh points t1,t2,.. .,tNt . What if we want to evaluate the numerical solution between the mesh points? The most natural choice is to assume a linear variation between the mesh points, see Fig. 8.5. This is compatible with the fact that when we plot the arrayu0,u1,.. .versus t0,t1,.. ., a straight line is automaticallydrawnbetweenthediscretepoints (unlesswespecifyotherwise in theplotcommand).
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition"
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
Web-Books
Bibliothek
Datenschutz
Impressum
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python