Page - 143 - in Programming for Computations β Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 143 -
Text of the Page - 143 -
6.3 TheCompositeMidpointMethod 143
Fig. 6.3 Computing approximately the integral of a function as the sum of the areas of the
rectangles
the trapezoidal method (10%) with the same sub-intervals. More rectangles give a
betterapproximation.
6.3.1 TheGeneralFormula
Let us derive a formula for the midpoint method based on n rectangles of equal
width:
β« b
a f(x)dx= β« x1
x0 f(x)dx+ β« x2
x1 f(x)dx+ . . .+ β« xn
xnβ1 f(x)dx,
βhf ( x0+x1
2 )
+hf ( x1+x2
2 )
+ . . .+hf (
xnβ1 +xn
2 )
,
βh (
f ( x0+x1
2 )
+f ( x1+x2
2 )
+ . . .+f ( xnβ1+xn
2 ))
.
(6.19)
This sum maybewrittenmorecompactlyas
β« b
a f(x)dxβh nβ1β
i=0 f(xi), (6.20)
wherexi = (
a+ h2 )+ ih.
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