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 - 232 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

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

Bild der Seite - 232 -

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

Text der Seite - 232 -

232 8 SolvingOrdinaryDifferentialEquations 8.3.5 AbstractProblemandNotation Whenwe hadaspecific differentialequationwith oneunknown,we quickly turned toanabstractdifferentialequationwritteninthegenericformu′ =f(u,t).Werefer to such a problem as a scalar ODE. A specific equation corresponds to a specific choiceof the formulaf(u,t) involvinguand(optionally) t. It is advantageous to also write a system of differential equations in the same abstractnotation, u′ =f(u,t), but this time it isunderstoodthatu is avectorof functionsandf is alsovector.We say thatu′ = f(u,t) is a vector ODE or system of ODEs in this case. For the SIR modelwe introduce the two3-vectors,onefor theunknowns, u= (S(t),I(t),R(t)), andone for the right-handside functions, f(u,t)= (−βSI,βSI−γI,γI). Theequationu′ =f(u,t)meanssetting the twovectorsequal, i.e., thecomponents mustbepairwiseequal.Sinceu′ = (S′,I′,R′), weget thatu′ =f implies S′ =−βSI, I′ =βSI−γI, R′ =γI . The generalized short notation u′ = f(u,t) is very handy since we can derive numerical methods and implement software for this abstract system and in a particular application just identify the formulas in the f vector, implement these, andcall functionality that solves thedifferentialequationsystem. 8.3.6 ProgrammingtheFEScheme;theGeneralCase InPythoncode, theForwardEuler step un+1 =un+Δtf(un,tn), beingascalar oravectorequation,canbecodedas u[n+1] = u[n] + dt*f(u[n], t[n]) both in the scalar and vector case. In the vector case, u[n] is a one-dimensional numpyarrayof lengthm+1 holding themathematicalquantityun, and the Python functionfmust returnanumpyarrayof lengthm+1.Then theexpressionu[n] + dt*f(u[n], t[n]) is anarrayplusa scalar timesanarray.
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