6.3 The Composite Midpoint Method
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
better approximation.
6.3.1 The General Formula
Let us derive a formula for the midpoint method based on n rectangles of equal
width:
b
a
f (x) dx =
x 1
x 0
f (x)dx +
x 2
x 1
f (x)dx + . . . +
x n
x n−1
f (x)dx,
≈ hf
x 0 + x 1
2
+ hf
x 1 + x 2
2
+ . . . + hf
x n−1 + x n
2
,
≈ h
f
x 0 + x 1
2
+ f
x 1 + x 2
2
+ . . . + f
x n−1 + x n
2
.
(6.19)
This sum may be written more compactly as
b
a
f (x)dx ≈ h
n−1
i=0
f (x i ),
(6.20)
where x i =
a +
h
2
+ ih.
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
better approximation.
6.3.1 The General Formula
Let us derive a formula for the midpoint method based on n rectangles of equal
width:
b
a
f (x) dx =
x 1
x 0
f (x)dx +
x 2
x 1
f (x)dx + . . . +
x n
x n−1
f (x)dx,
≈ hf
x 0 + x 1
2
+ hf
x 1 + x 2
2
+ . . . + hf
x n−1 + x n
2
,
≈ h
f
x 0 + x 1
2
+ f
x 1 + x 2
2
+ . . . + f
x n−1 + x n
2
.
(6.19)
This sum may be written more compactly as
b
a
f (x)dx ≈ h
n−1
i=0
f (x i ),
(6.20)
where x i =
a +
h
2
+ ih.
