6.2 The Composite Trapezoidal Rule
135
Fig. 6.2 Computing approximately the integral of a function as the sum of the areas of the
trapezoids
h 3 = (0.8 − 0.6),
(6.12)
h 4 = (1.0 − 0.8)
(6.13)
With v(t) = 3t 2 e t 3 , each term in (6.9) is readily computed and our approximate
computation gives
1
0
v(t)dt ≈ 1.895 .
(6.14)
Compared to the true answer of 1.718, this is off by about 10%. However, note
that we used just four trapezoids to approximate the area. With more trapezoids,
the approximation would have become better, since the straight line segments
at the upper trapezoid side then would follow the graph more closely. Doing
another hand calculation with more trapezoids is not too tempting for a lazy
human, though, but it is a perfect job for a computer! Let us therefore derive
the expressions for approximating the integral by an arbitrary number of trapezoids.
6.2.1 The General Formula
For a given function f (x), we want to approximate the integral
b
a f (x)dx by n
trapezoids (of equal width). We start out with (6.5) and approximate each integral
135
Fig. 6.2 Computing approximately the integral of a function as the sum of the areas of the
trapezoids
h 3 = (0.8 − 0.6),
(6.12)
h 4 = (1.0 − 0.8)
(6.13)
With v(t) = 3t 2 e t 3 , each term in (6.9) is readily computed and our approximate
computation gives
1
0
v(t)dt ≈ 1.895 .
(6.14)
Compared to the true answer of 1.718, this is off by about 10%. However, note
that we used just four trapezoids to approximate the area. With more trapezoids,
the approximation would have become better, since the straight line segments
at the upper trapezoid side then would follow the graph more closely. Doing
another hand calculation with more trapezoids is not too tempting for a lazy
human, though, but it is a perfect job for a computer! Let us therefore derive
the expressions for approximating the integral by an arbitrary number of trapezoids.
6.2.1 The General Formula
For a given function f (x), we want to approximate the integral
b
a f (x)dx by n
trapezoids (of equal width). We start out with (6.5) and approximate each integral
