Page 237 - Applied Numerical Methods Using MATLAB
P. 237
226 NUMERICAL DIFFERENTIATION/ INTEGRATION
will change if the segment width h is halved to h/2. Noting that, from Eq. (5.5.11),
h (4)
x k+1
5
E S (h) = f(x) dx − I S (x k−1 ,x k+1 ,h) ≈− f (c)(c ∈ [x k−1 ,x k+1 ])
90
x k−1
h x k+1 h
E S ( ) = f(x) dx − I S x k−1 ,x k+1 ,
2 2
x k−1
x k h x k+1
= f(x) dx − I S x k−1 ,x k , + f(x) dx
2
x k−1 x k
h
− I S x k ,x k+1 , (c ∈ [x k−1 ,x k+1 ])
2
(h/2) 5 (4) 1
≈−2 f (c) = E S (h)
90 16
we can express the change of the error caused by halving the segment width
as
h h
E S (h) − E S
= I S (x k−1 ,x k+1 ,h) − I S x k−1 ,x k+1 ,
2 2
15
h
≈ |E S (h)|≈ 15 E S (5.5.12)
16 2
This suggests the error estimate of numerical integration by Simpson’s rule as
1
h h
E S
≈ I S (x k−1 ,x k+1 ,h) − I S x k−1 ,x k+1 , (5.5.13)
2 2 − 1 2
4
Also for the trapezoidal rule, similar result can be derived:
1
h h
E T I T (x k−1 ,x k+1 ,h) − I T
≈ x k−1 ,x k+1 , (5.5.14)
2 2 − 1 2
2
5.6 TRAPEZOIDAL METHOD AND SIMPSON METHOD
In order to get the formulas for numerical integration of a function f(x) over
some interval [a, b], we divide the interval into N segments of equal length
h = (b − a)/N so that the nodes (sample points) can be expressed as {x = a +
kh, k = 0, 1, 2,...,N}. Then we have the numerical integration of f(x) over
[a, b] by the trapezoidal rule (5.5.3) as
b N−1 x k+1
f(x) dx = f(x) dx
a
k=0 x k
h
∼
= {(f 0 + f 1 ) + (f 1 + f 2 ) +· · · + (f N−2 + f N−1 ) + (f N−1 + f N )}
2