Seite - 143 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 143 -
Text der Seite - 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, Band Second Edition
- Titel
- Programming for Computations – Python
- Untertitel
- A Gentle Introduction to Numerical Simulations with Python 3.6
- Band
- Second Edition
- Autoren
- Svein Linge
- Hans Petter Langtangen
- Verlag
- Springer Open
- Datum
- 2020
- Sprache
- englisch
- Lizenz
- CC BY 4.0
- ISBN
- 978-3-319-32428-9
- Abmessungen
- 17.8 x 25.4 cm
- Seiten
- 356
- Schlagwörter
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Kategorie
- Informatik