Seite - 113 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Bild der Seite - 113 -
Text der Seite - 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.
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python
- Titel
- Programming for Computations – Python
- Untertitel
- A Gentle Introduction to Numerical Simulations with Python
- Autoren
- Svein Linge
- Hans Petter Langtangen
- Verlag
- Springer Open
- Datum
- 2016
- Sprache
- englisch
- Lizenz
- CC BY-NC 4.0
- ISBN
- 978-3-319-32428-9
- Abmessungen
- 17.8 x 25.4 cm
- Seiten
- 248
- Schlagwörter
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Kategorie
- Informatik