Page - 122 - in Programming for Computations β Python - A Gentle Introduction to Numerical Simulations with Python
Image of the Page - 122 -
Text of the Page - 122 -
122 4 SolvingOrdinaryDifferentialEquations
Thenew,extendeddifferential equationswith theV quantitybecome
S0 D ΛSI C R pS; (4.36)
V 0 DpS; (4.37)
I 0 DΛSI I; (4.38)
R0 D I R: (4.39)
Weshall refer to thismodelas theSIRVmodel.
The new equation forV 0 poses no difficulties when it comes to the numerical
method. InaForwardEuler schemewesimplyaddanupdate
VnC1 DVnCp tSn :
Theprogramneeds tostoreV.t/ inanadditionalarrayV, andtheplottingcommand
must be extendedwithmore arguments to plot V versus t aswell. The complete
code is found in thefileSIRV1.py.
Using p D 0:0005 andp D 0:0001 as values for the vaccine efficiency pa-
rameter, the effect of vaccination is seen in Fig. 4.13 (other parameters are as in
Fig. 4.11).
Fig.4.13 Theeffect ofvaccination:pD0:0005 (left)andpD0:0001 (right)
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