Simpson S Rules
Simpson S Rules
Finally, round-off errors can limit our ability to determine integrals. This is due both
to the machine precision as well as to the numerous computations involved in simple
techniques like the multiple-segment trapezoidal rule.
We now turn to one way in which efficiency is improved. That is, by using higher-
order polynomials to approximate the integral.
f(x2 ) d dx
(x 2 x0 )(x 2 x1 )
1
(x2 2 x0 )(x2 2 x1 )
FIGURE 21.10
(a) Graphical depiction of f (x) f (x)
Simpson’s 1/3 rule: It consists
of taking the area under a
parabola connecting three
points. (b) Graphical depiction
of Simpson’s 3/8 rule: It
consists of taking the area under
a cubic equation connecting
four points.
x x
(a) (b)
616 NEWTON-COTES INTEGRATION FORMULAS
As was done in Box 21.2 for the trapezoidal rule, Simpson’s 1y3 a2 a3 a2
rule can be derived by integrating the forward Newton-Gregory I 5 h c a f (x0 ) 1 ¢f (x0 ) 1 a 2 b ¢ 2 f (x0 )
2 6 4
interpolating polynomial (Box 18.2):
a4 a3 a2
x2
¢ 2 f (x0 ) 1a 2 1 b ¢ 3 f (x0 )
I5 # c f (x0 ) 1 ¢f (x0 )a 1 a(a 2 1) 24 6 6
2
a5 a4 11a3 a2 2
1a 2 b f (4) (j)h4 d
x0
¢ f (x0 ) 3 2 1
120 16 72 8 0
1 a(a 2 1) (a 2 2)
6 and evaluated for the limits to give
f (4) (j)
a(a 2 1) (a 2 2) (a 2 3)h4 d dx ¢ 2 f (x0 )
I 5 h c 2 f (x0 ) 1 2¢ f (x0 ) 1
1
24
3
Notice that we have written the polynomial up to the fourth-order
f (j)h4 d
1 (4)
term rather than the third-order term as would be expected. The 1 (0) ¢ 3 f (x0 ) 2 (B21.3.1)
reason for this will be apparent shortly. Also notice that the limits 90
of integration are from x0 to x2. Therefore, when the simplifying Notice the significant result that the coefficient of the third divided
substitutions are made (recall Box 21.2), the integral is from a 5 difference is zero. Because Df(x0) 5 f(x1) 2 f(x0) and D2f(x0) 5
0 to 2: f(x2) 2 2f(x1) 1 f(x0), Eq. (B21.3.1) can be rewritten as
2
¢ 2 f (x0 )
I5h # c f (x0 ) 1 ¢f (x0 )a 1 a(a 2 1) h 1 (4)
0
2 I5 [ f (x0 ) 1 4 f (x1 ) 1 f (x2 ) ] 2 f (j)h5
3 90
¢ 3 f (x0 ) Simpson’s 1y3 Truncation error
1 a(a 2 1) (a 2 2)
6
(4) Thus, the first term is Simpson’s 1y3 rule and the second is the
a(a 2 1) (a 2 2) (a 2 3)h4 d da
f (j)
1 truncation error. Because the third divided difference dropped
24
out, we obtain the significant result that the formula is third-order
which can be integrated to yield accurate.
21.2 SIMPSON’S RULES 617
where a 5 x0, b 5 x2, and x1 5 the point midway between a and b, which is given by
(b 1 a)y2. Notice that, according to Eq. (21.15), the middle point is weighted by two-
thirds and the two end points by one-sixth.
It can be shown that a single-segment application of Simpson’s 1y3 rule has a trun-
cation error of (Box 21.3)
1 5 (4)
Et 5 2 h f (j)
90
or, because h 5 (b 2 a)y2,
(b 2 a) 5 (4)
Et 5 2 f (j) (21.16)
2880
where j lies somewhere in the interval from a to b. Thus, Simpson’s 1Y3 rule is more
accurate than the trapezoidal rule. However, comparison with Eq. (21.6) indicates that it
is more accurate than expected. Rather than being proportional to the third derivative,
the error is proportional to the fourth derivative. This is because, as shown in Box 21.3,
the coefficient of the third-order term goes to zero during the integration of the interpo-
lating polynomial. Consequently, Simpson’s 1Y3 rule is third-order accurate even though
it is based on only three points. In other words, it yields exact results for cubic polyno-
mials even though it is derived from a parabola!
derivative is not an exact estimate of f (4)(j). However, because this case deals with a fifth-
order polynomial, the result matches.
n21 n22
f(x0 ) 1 4 a f(xi ) 1 2 a f(xj ) 1 f(xn )
i51, 3, 5 j52, 4, 6
I > (b 2 a) (21.18)
3n
Width Average height
FIGURE 21.11
Graphical representation of f (x)
the multiple application of
Simpson’s 1y3 rule. Note that
the method can be employed
only if the number of segments
is even.
a b x
21.2 SIMPSON’S RULES 619
Notice that, as illustrated in Fig. 21.11, an even number of segments must be utilized to
implement the method. In addition, the coefficients “4” and “2” in Eq. (21.18) might
seem peculiar at first glance. However, they follow naturally from Simpson’s 1y3 rule.
The odd points represent the middle term for each application and hence carry the weight
of 4 from Eq. (21.15). The even points are common to adjacent applications and hence
are counted twice.
An error estimate for the multiple-application Simpson’s rule is obtained in the same
fashion as for the trapezoidal rule by summing the individual errors for the segments
and averaging the derivative to yield
(b 2 a) 5
Ea 5 2 f (4) (21.19)
180n4
as Simpson’s 3y8 rule is used in conjunction with the 1y3 rule to permit evaluation
of both even and odd numbers of segments.
to yield
3h
I> [ f(x0 ) 1 3 f(x1 ) 1 3 f(x2 ) 1 f(x3 )]
8
where h 5 (b 2 a)y3. This equation is called Simpson’s 3y8 rule because h is multiplied
by 3y8. It is the third Newton-Cotes closed integration formula. The 3y8 rule can also
be expressed in the form of Eq. (21.5):
Thus, the two interior points are given weights of three-eighths, whereas the end points
are weighted with one-eighth. Simpson’s 3y8 rule has an error of
3 5 (4)
Et 5 2 h f (j)
80
or, because h 5 (b 2 a)y3,
(b 2 a) 5 (4)
Et 5 2 f (j) (21.21)
6480
Because the denominator of Eq. (21.21) is larger than for Eq. (21.16), the 3y8 rule is
somewhat more accurate than the 1y3 rule.
Simpson’s 1y3 rule is usually the method of preference because it attains third-
order accuracy with three points rather than the four points required for the 3y8
version. However, the 3y8 rule has utility when the number of segments is odd. For
instance, in Example 21.5 we used Simpson’s rule to integrate the function for four
segments. Suppose that you desired an estimate for five segments. One option would
be to use a multiple-application version of the trapezoidal rule as was done in Ex-
amples 21.2 and 21.3. This may not be advisable, however, because of the large
truncation error associated with this method. An alternative would be to apply Simp-
son’s 1y3 rule to the first two segments and Simpson’s 3y8 rule to the last three
(Fig. 21.12). In this way, we could obtain an estimate with third-order accuracy
across the entire interval.
21.2 SIMPSON’S RULES 621
f (x)
FIGURE 21.12
Illustration of how Simpson’s
1y3 and 3y8 rules can be 0
0 0.2 0.4 0.6 0.8 x
applied in tandem to handle
multiple applications with odd 1/3 rule 3/8 rule
numbers of intervals.
(a) (d )
FUNCTION Simp13 (h, f0, f1, f2) FUNCTION SimpInt(a,b,n,f)
Simp13 5 2*h* (f014*f11f2) / 6 h 5 (b 2 a) / n
END Simp13 IF n 5 1 THEN
(b) sum 5 Trap(h,fn21,fn)
FUNCTION Simp38 (h, f0, f1, f2, f3) ELSE
Simp38 5 3*h* (f013*(f11f2)1f3) / 8 m5 n
END Simp38 odd 5 n / 2 2 INT(n / 2)
IF odd . 0 AND n . 1 THEN
(c)
sum 5 sum1Simp38(h,fn23,fn22,fn21,fn)
FUNCTION Simp13m (h, n, f) m 5 n 23
sum 5 f(0) END IF
DOFOR i 5 1, n 2 2, 2 IF m . 1 THEN
sum 5 sum 1 4 * fi 1 2 * fi11 sum 5 sum 1 Simp13m(h,m,f)
END DO END IF
sum 5 sum 1 4 * fn21 1 fn END IF
Simp13m 5 h * sum / 3 SimpInt 5 sum
END Simp13m END SimpInt
FIGURE 21.13
Pseudocode for Simpson’s rules. (a) Single-application Simpson’s 1y3 rule, (b) single-
application Simpson’s 3y8 rule, (c) multiple-application Simpson’s 1y3 rule, and (d) multiple-
application Simpson’s rule for both odd and even number of segments. Note that for all cases,
n must be $1.
TABLE 21.2 Newton-Cotes closed integration formulas. The formulas are presented in the
format of Eq. (21.5) so that the weighting of the data points to estimate the
average height is apparent. The step size is given by h 5 (b 2 a)/n.
Segments
(n) Points Name Formula Truncation Error
f (x0 ) 1 f (x1 )
2 (1y12)h3f''(j)
1 2 Trapezoidal rule (b 2 a)
2
4 5 Boole’s rule (b 2 a)
90
19f (x0 ) 1 75f (x1 ) 1 50f (x2 ) 1 50f (x3 ) 1 75f (x4 ) 1 19f (x5 )
2 (275y12,096)h7f (6)(j)
5 6 (b 2 a)
288