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

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

Bild der Seite - 235 -

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

Text der Seite - 235 -

8.3 SpreadingofDisease:ASystemofFirstOrderODEs 235 8.3.7 Time-RestrictedImmunity Let us now assume that immunity after the disease only lasts for some certain time period.Thismeans that there is transport fromtheRstate to theS state: Modeling the loss of immunity is very similar to modeling recovery from the disease: the amount of people losing immunity is proportional to the amount of recoveredpatientsandthe lengthof the timeintervalΔt.Wecanthereforewrite the loss in the R categoryas−νΔtR in timeΔt, whereν−1 is the typical time it takes to lose immunity.Theloss inR(t) isagaininS(t).The“budgets”for thecategories thereforebecome Sn+1 =Sn−βΔtSnIn+νΔtRn, (8.30) In+1 = In+βΔtSnIn−γΔtIn, (8.31) Rn+1 =Rn+γΔtIn−νΔtRn . (8.32) DividingbyΔt and lettingΔt→0gives thedifferentialequationsystem S′ =−βSI+νR, (8.33) I′ =βSI−γI, (8.34) R′ =γI−νR. (8.35) Thissystemcanbesolvedby thesamemethodsaswedemonstratedfor theoriginal SIRmodel.Onlyonemodificationintheprogramisnecessary:addingdt*nu*R[n] to theS[n+1]updateandsubtracting thesamequantity in theR[n+1]update: for n in range(N_t): S[n+1] = S[n] - dt*beta*S[n]*I[n] + dt*nu*R[n] I[n+1] = I[n] + dt*beta*S[n]*I[n] - dt*gamma*I[n] R[n+1] = R[n] + dt*gamma*I[n] - dt*nu*R[n] Themodifiedcode is foundin thefileSIR2.py. Setting ν−1 to 50 days, reducingβ by a factor of 4 compared to the previous example (β = 0.00033), and simulating for 300 days gives an oscillatory behavior in the categories, as depicted in Fig. 8.13. It is easy now to play around and study how the parameters affect the spreading of the disease. For example, making the disease slightly more effective (increaseβ to 0.00043) and increasing the average time to lossof immunity to90days lead tootheroscillations, see Fig.8.14.
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