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 - 228 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

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

Image of the Page - 228 -

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

Text of the Page - 228 -

228 8 SolvingOrdinaryDifferentialEquations Since there is no loss in the R category (people are either recovered and immune, ordead),we are donewith the modelingof this category. In fact, we do not strictly needEq. (8.14)forR, butextensionsof themodel laterwillneedanequationforR. Dividing by Δt in (8.13) and (8.14) and letting Δt → 0, results in the correspondingdifferentialequations I′ =βSI−γI, (8.15) and R′ =γI . (8.16) To summarize, we have derived three differenceequationsand three differential equations,whichwe list here foreasy reference.Thedifferenceequationsare: Sn+1 =Sn−βΔtSnIn, (8.17) In+1 = In+βΔtSnIn−γΔtIn, (8.18) Rn+1 =Rn+γΔtIn . (8.19) Note that we have isolated the new unknown quantitiesSn+1, In+1, andRn+1 on the left-hand side, such that these can readily be computed if Sn, In, and Rn are known.Togetsuchaprocedurestarted,weneedtoknowS0,I0,R0.Obviously,we alsoneed tohavevalues for theparametersβ andγ . The threedifferentialequationsare: S′ =−βSI, (8.20) I′ =βSI−γI, (8.21) R′ =γI . (8.22) This differential equation model (and also its discrete counterpart above) is known as an SIR model. The input data to the differential equation model consist of the parametervaluesforβ andγ , aswellas the initialconditionsS(0)=S0,I(0)= I0, andR(0)=R0. 8.3.2 AFEMethodfortheSystemofODEs Letusapplythesameprinciplesaswedid inSect.8.2.2 todiscretize thedifferential equation system by the Forward Euler method. We already have a time mesh and time-discretequantitiesSn, In,Rn,n=0,.. .,Nt. The threedifferentialequations areassumedto bevalidat themeshpoints.At thepoint tn wethenhave S′(tn)=−βS(tn)I(tn), (8.23) I′(tn)=βS(tn)I(tn)−γI(tn), (8.24) R′(tn)=γI(tn), (8.25)
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