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

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

Image of the Page - 161 -

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

Text of the Page - 161 -

6.7 DoubleandTriple Integrals 161 LetTest FunctionsSpeakUp? Ifwecall theabovetest_midpoint_doublefunctionandnothinghappens, our implementations are correct. However, it is somewhat annoying to have a function that is completely silent when it worksβ€”arewe sure all thingsare properlycomputed?Duringdevelopment it is thereforehighly recommended to insert a print command such that we can monitor the calculations and be convinced that the test function does what we want. Since a test function should not have any print command, we simply comment it out as we have done in the function listedabove. The trapezoidal method can be used as alternative for the midpoint method. The derivationof a formula for the double integral and the implementations follow exactly the same ideas as we explained with the midpoint method, but there are more terms towrite in the formulas.Exercise6.13asksyou to carryout the details. That exercise is a very good test on your understanding of the mathematical and programmingideas in thepresent section. 6.7.2 TheMidpointRuleforaTripleIntegral Theory Once a method that works for a one-dimensional problem is generalized to two dimensions, it is usually quite straightforward to extend the method to three dimensions.Thiswillnowbedemonstratedfor integrals.Wehavethe triple integral ∫ b a ∫ d c ∫ f e g(x,y,z)dzdydx andwant toapproximatethe integralbyamidpointrule.Followingthe ideas for the double integral,we split this integral intoone-dimensional integrals: p(x,y)= ∫ f e g(x,y,z)dz q(x)= ∫ d c p(x,y)dy ∫ b a ∫ d c ∫ f e g(x,y,z)dzdydx= ∫ b a q(x)dx
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