Page - 230 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 230 -
Text of the Page - 230 -
230 8 SolvingOrdinaryDifferentialEquations
plt.savefig(’tmp.pdf’); plt.savefig(’tmp.png’)
plt.show()
This program was written to investigate the spreading of flu at the mentioned
boardingschool,andthereasoningfor thespecificchoicesβ andγ goesas follows.
At some other school where the disease has already spread, it was observed that
in the beginning of a day there were 40 susceptibles and 8 infected, while the
numbers were 30 and 18, respectively, 24h later. Using 1h as time unit, we then
have from (8.11) that β = 10/(40 ·8 ·24). Among 15 infected, it was observed
that 3 recovered during a day, givingγ = 3/(15 ·24). Applying these parameters
to a new case where there is one infected initially and 50 susceptibles, gives
the graphs in Fig. 8.11. These graphs are just straight lines between the values
at times ti = iΔt as computed by the program. We observe that S reduces
as I and R grows. After about 30 days everyone has become ill and recovered
again.
Wecanexperimentwithβ andγ toseewhetherwegetanoutbreakof thedisease
ornot.Imaginethata“washyourhands”campaignwassuccessfulandthat theother
school in this case experienceda reductionofβ by a factor of 5. With this lowerβ
the disease spreads very slowly so we simulate for 60 days. The curves appear in
Fig.8.12.
8.3.4 OutbreakorNot
Lookingat the equation for I, it is clear that we must haveβSI−γI > 0 for I to
increase.Whenwe start the simulation it means that
βS(0)I(0)−γI(0)>0,
Fig. 8.11 Natural evolution of flu at a boarding school
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