
132 Numerical Methods and Optimization: An Introduction
Simpson’s Rule:
+
b
a
f(x)dx ≈
b − a
6
f(a)+4f
a + b
2
+ f(b)
. (6.6)
Example 6.3 For the same integrals as in Example 6.2, Simpson’s rule gives
+
1
0
exp(x
2
)dx ≈
1
6
(exp(0) + 4 exp(1/4) + exp(1)) ≈ 1.47573,
+
5
1
sin x
x
dx ≈
5 − 1
6
sin 1 + 4
sin 3
3
+
sin 5
5
≈ 0.55856.
6.3 Precision and Error of Approximation
Consider the quadrature formula (6.3), Q
n
(f)=
n
i=0
A
i
f(x
i
), where
A
i
=
,
b
a
l
i
(x)dx.
Definition 6.1 (Precision of a Quadrature Formula) If Q
n
(f)=
,
b
a
f(x)dx for all polynomials f of degree ≤ m, and if there exists a
polynomial
ˆ
f of degree m +1 for which Q
n
(
ˆ
f) =
,
b
a
ˆ
f(x)dx, then we say
that the formula has precision