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

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

Image of the Page - XVIII -

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

Text of the Page - XVIII -

xviii Contents 6.6.3 FinitePrecisionofFloating-PointNumbers . . . . . . . . . . . . . 153 6.6.4 ConstructingUnitTests andWritingTest Functions . . . . . . 155 6.7 DoubleandTriple Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 6.7.1 TheMidpointRule foraDouble Integral . . . . . . . . . . . . . . . 157 6.7.2 TheMidpointRule foraTriple Integral . . . . . . . . . . . . . . . . 161 6.7.3 MonteCarlo IntegrationforComplex-ShapedDomains . . . 163 6.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 7 SolvingNonlinearAlgebraicEquations . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 7.1 Brute ForceMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 7.1.1 BruteForceRootFinding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 7.1.2 BruteForceOptimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 7.1.3 ModelProblemforAlgebraicEquations. . . . . . . . . . . . . . . . 180 7.2 Newton’sMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 7.2.1 DerivingandImplementingNewton’sMethod . . . . . . . . . . 181 7.2.2 Makinga MoreEfficientandRobust Implementation. . . . . 184 7.3 TheSecantMethod. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 7.4 TheBisection Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 7.5 Rate ofConvergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 7.6 SolvingMultipleNonlinearAlgebraicEquations . . . . . . . . . . . . . . . . 195 7.6.1 AbstractNotation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 7.6.2 TaylorExpansionsforMulti-VariableFunctions . . . . . . . . . 195 7.6.3 Newton’sMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 7.6.4 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 7.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 8 SolvingOrdinaryDifferentialEquations . . . . . . . . . . . . . . . . . . . . . . . . . 203 8.1 Filling aWater Tank:TwoCases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 8.1.1 Case 1:Piecewise ConstantRate . . . . . . . . . . . . . . . . . . . . . . 205 8.1.2 Case 2:Continuously IncreasingRate. . . . . . . . . . . . . . . . . . 207 8.1.3 Reformulating theProblemsasODEs. . . . . . . . . . . . . . . . . . 209 8.2 PopulationGrowth:A First OrderODE. . . . . . . . . . . . . . . . . . . . . . . . 210 8.2.1 Derivationof the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 8.2.2 NumericalSolution:TheForwardEuler (FE)Method . . . . 213 8.2.3 ProgrammingtheFE Scheme; theSpecialCase. . . . . . . . . . 217 8.2.4 Understandingthe ForwardEulerMethod . . . . . . . . . . . . . . 219 8.2.5 ProgrammingtheFE Scheme; theGeneralCase . . . . . . . . . 220 8.2.6 A MoreRealistic PopulationGrowthModel . . . . . . . . . . . . 221 8.2.7 Verification: Exact Linear Solution of the Discrete Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 8.3 SpreadingofDisease: ASystem ofFirst OrderODEs . . . . . . . . . . . . 225 8.3.1 SpreadingofFlu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 8.3.2 A FEMethodfor theSystemofODEs . . . . . . . . . . . . . . . . . 228 8.3.3 ProgrammingtheFE Scheme; theSpecialCase. . . . . . . . . . 229 8.3.4 OutbreakorNot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 8.3.5 AbstractProblemandNotation . . . . . . . . . . . . . . . . . . . . . . . 232 8.3.6 ProgrammingtheFE Scheme; theGeneralCase . . . . . . . . . 232 8.3.7 Time-Restricted Immunity . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
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