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

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

Image of the Page - 113 -

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

Text of the Page - 113 -

4.2 SpreadingofDiseases 113 threedifferenceequations: SnC1 DSn ˇ tSnIn; (4.17) InC1 DInCˇ tSnIn tIn; (4.18) RnC1 DRnC tIn : (4.19) Note thatwe have isolated the newunknownquantitiesSnC1, InC1, andRnC1 on the left-hand side, such that these can readily be computed ifSn, In, andRn are known. Toget such a procedure started,weneed to knowS0, I0,R0. Obviously, wealsoneed tohavevalues for theparametersˇ and . Wealso list thesystemof threedifferential equations: S0 D ˇSI; (4.20) I 0 DˇSI I; (4.21) R0 D I : (4.22) This differential equationmodel (andalso its discrete counterpart above) is known as an SIR model. The input data to the differential equationmodel consist of the parametersˇ and aswell as the initial conditionsS.0/ D S0, I.0/ D I0, and R.0/DR0. 4.2.2 AForwardEulerMethodfortheDifferentialEquationSystem LetusapplythesameprinciplesaswedidinSect.4.1.2todiscretize thedifferential equation systemby theForwardEulermethod. We alreadyhave a timemesh and time-discretequantitiesSn,In,Rn,nD0;:: :;Nt. Thethreedifferentialequations areassumed tobevalidat themeshpoints.At thepoint tnwethenhave S0.tn/D ˇS.tn/I.tn/; (4.23) I 0.tn/DˇS.tn/I.tn/ I.tn/; (4.24) R0.tn/D I.tn/; (4.25) fornD 0;1;:: :;Nt. This is an approximation since the differential equations are originallyvalidat all times t (usually in somefinite interval Œ0;T ). Using forward finitedifferences for thederivatives results inanadditionalapproximation, SnC1 Sn t D ˇSnIn; (4.26) InC1 In t DˇSnIn In; (4.27) RnC1 Rn t D In: (4.28) Aswe see, these equations are identical to the difference equations that naturally arise in the derivation of themodel. However, other numericalmethods than the ForwardEuler schemewill result in slightlydifferentdifferenceequations.
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