Documente Academic
Documente Profesional
Documente Cultură
5 Numerical Integration
cos x
3 7 5 6
1 x 12 dx, x cos x dx,
1
x
1
3
1 3
x
dx, 1 x 3 dx,
2
12 9 1
1 sin 2 x dx, sin x 2 dx, exp x 3 dx
3 5 0
The above integrals are very difficult to evaluate by using the methods in
sections 7.1~7.4. Two numerical methods can be used effectively for
estimating a definite integral: the trapezoidal rule and Simpson’s rule.
the trapezoids,
b
f x0 f x1 b a f x1 f x2 b a f xn 1 f x n b a
f x dx
a
2 n 2 n 2 n
b a
f x0 2 f x1 2 f x n 1 f x n
2n
Example 22:
As n 4 , x ,
4
2 3
sin x dx 2 4 sin 0 2 sin 4 2 sin
0
4
2 sin
4
sin
8
0 2 2 2 0
1 2
4
1.896
As n 8 , x ,
8
1
7
sin x dx 2 8 sin 0 2 sin 8 2 sin
0
sin
8
3
2 2 2 4 sin 4 sin
16 8 8
1.974
Theorem 2:
p x Ax 2 Bx C . Then,
d d
d c p c 4 p c d p d
p x dx Ax Bx C dx
2
c c
6 2
b
2 b a 2 b a
n n
f x dx f x 0 4 f x1 f x 2 f x 2 4 f x3 f x 4
a
6 6
2 b a 2 b a
n n
f x n 4 4 f x n 3 f x n 2 f x n 2 4 f x n 1 f x n
6 6
b a f x 4 f x 2 f x 4 f x 2 f x 4 f x f x
0 1 2 3 4 n 1 n
3n
Example 22 (continue):
As n 4 , the
2 3
sin x dx 3 4 sin 0 4 sin 4 2 sin
0
4 sin
4 4
sin
12
4 22
2.005
As n 8 , x ,
8
2
2 7
sin x dx 3 8 sin 0 4 sin 8 2 sin
0
4 sin
8 8
sin
3
2 2 2 8 sin 8 sin
24 8 8
2.0003
nT M
b a 3 .
12n 2
nS M
b a 5 .
180n 4
Note:
The above results can be used to obtain the required number of
partitions, n .
Example 23:
Determine a value of n so that the trapezoidal rule will approximate the value of
1
0
1 x 2 dx with an error that is less than 0.01.
[solutions:]
3
f '' x 1 x 2 3
2
1, x 0,1 .
Thus,
nT M
b a 3 1
1 0 3
1
.
2 2
12n 12n 12n 2
As
1
2
0.01 12n 2 100 n 2.89 n 3 ,
12n
1
the error is smaller than 0.01. As n 3 , x ,
3
1
1 2 2
0
1 x 2 dx
23
1 02 2 1 1 2 1 2
3 3
2 1 12
1.154
Thus,
1
0
1 x 2 dx 1.154 0.01
1
1.144 1.154 0.01
0
1 x 2 dx 1.154 0.01 1.164
Example 24:
Determine a value of n so that the Simpson’s rule will approximate the value of
1
cos x dx
2
with an error that is less than 0.001.
0
[solutions:]
f x cos x 2 f 4 x 4 4 x 3 3 cos x 2 12 x 2 sin x 2
As x 1 , f 4 x attains its maximum over 0,1 , i.e.,
f 4 x 4 cos1 12 sin 1 42.6 43, x 0,1 .
Let M 43 .
nT M
b a 5 43
1 0 5
43
.
4 4
180n 180n 180n 4
As
43 4300
4
0.01 n 4 23.88 n 2.2 n 3 n 4
180n 180