11—Numerical Analysis 32411.4 Integration
The basic definition of an integral is a limit of the sum,
ξ 1 ξ 2 ξ 3 ξ 4 ξ 5∑
f(ξi)(xi+1−xi) (xi≤ξi≤xi+1), (14)and this is the basis for the numerical evaluation of any integral, as in section1.6.
The simplest choices to evaluate the integral off(x)over the domainx 0 tox 0 +hwould be to take the
position ofξat one of the endpoints or maybe in the middle (here I assumehis small).
∫x 0 +hx 0f(x)dx≈f(x 0 )h (a)or f(x 0 +h)h (b)
or f(x 0 +h/2)h (midpoint rule) (c)
or[
f(x 0 ) +f(x 0 +h)]
h/ 2 (trapezoidal rule) (d)(15)
The last expression is the average of the first two.
I can now compare the errors in all of these approximations. Setx 0 = 0.
∫h
0dxf(x) =∫h0dx[
f(0) +xf′(0) +1
2
x^2 f′′(0) +1
6
x^3 f′′′(0) +···]
=hf(0) +1
2
h^2 f′(0) +1
6
h^3 f′′(0) +1
24
h^4 f′′′(0) +···.This immediately gives the error in formula (a):
error (a) =hf(0)−∫h0dxf(x)≈−1
2
h^2 f′(0). (16)