Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Page - 238 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 238 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 238 -

Image of the Page - 238 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 238 -

238 8 SolvingOrdinaryDifferentialEquations Fig. 8.15 The effect ofvaccination:p=0.0005 Fig. 8.16 The effect ofvaccination:p=0.0001 is usually quite a challenge in mathematics, but as long as we solve the equations numerically ina program,adiscontinuouscoefficient is easy to treat. There are two ways to implement the discontinuous coefficientp(t): through a functionand throughanarray.The functionapproachisperhaps theeasiest: def p(t): return 0.005 if (6*24 <= t <= 15*24) else 0 Note the handyif-else construction in the return statement here. It is a one-line alternative to, forexample, if (6*24 <= t <= 15*24): return 0.005
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
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
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python