
Numerical Integration 137
Using the composite Simpson’s rule, we have:
+
4
1
1
x
dx =
3
i=1
+
i+1
i
1
x
dx
≈
3
i=1
1
6
1
i
+4
2
2i +1
+
1
i +1
=
1
6
1+
8
3
+
1
2
+
1
2
+
8
5
+
1
3
+
1
3
+
8
7
+
1
4
=
3497
2520
≈ 1.3877.
The absolute error is 1.3877 − ln 4 ≈ 0.0014 in this case.
6.5 Using Integrals to Approximate Sums
If the value of an integral can be computed analytically, the numerical
methods for computing integrals can be used to approximate the sums ap-
pearing in the corresponding computations. For example, consider the integral
+
N
1
1
x
dx.
We can use the composite trapezoidal rule with step size h = 1 to estimate
this integral.
+
N
1
1
x
dx =
N−1
i=1
+
i+1
i
1
x
dx
≈
1
2
N−1
i=1
1
i
+
1
i +1
=
1
2
N−1
i=1
1
i
+
N
i=2 ...