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 - 239 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

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

Image of the Page - 239 -

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

Text of the Page - 239 -

8.4 Oscillating1DSystems:ASecondOrderODE 239 Fig. 8.17 The effect of a vaccination campaign else: return 0 In the codeforupdating thearraysSandV,we thengeta termp(t[n])*S[n]. Alternatively,we can instead letp(t)be an array filled with correct valuesprior to thesimulation.Thenwe need to allocate an arraypof lengthN_t+1andfind the indices corresponding to the time period between 6 and 15 days. These indices are foundfromthe time pointdividedbyΔt. That is, p = zeros(N_t+1) start_index = 6*24/dt stop_index = 15*24/dt p[start_index:stop_index] = 0.005 The p(t)S(t) term in the updating formulas for S and V simply becomes p[n]*S[n].ThefileSIRV2.pycontainsa programbasedonfillingan arrayp. The effect of a vaccination campaign is illustrated in Fig. 8.17. All the data are as inFig.8.15,except thatp is ten timesstronger foraperiodof10daysandp=0 elsewhere. 8.4 Oscillating1DSystems:ASecondOrderODE Numerous engineering constructions and devices contain materials that act like springs. Such springs give rise to oscillations, and controlling oscillations is a key engineeringtask. We shallnowlearn to simulateoscillatingsystems. Asalways,westartwith thesimplestmeaningfulmathematicalmodel,whichfor oscillations is a second-orderdifferentialequation: u′′(t)+ω2u(t)=0, (8.40)
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