Seite - 228 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 228 -
Text der Seite - 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)
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