Chapter 4: Integrals: by Assoc - Prof. Mai Duc Thanh
Chapter 4: Integrals: by Assoc - Prof. Mai Duc Thanh
Chapter 4: Integrals: by Assoc - Prof. Mai Duc Thanh
Part 3
By
Assoc.Prof. Mai Duc Thanh
Outline
1. Approximate Integration
1. Mid-Point Rule
2. Trapezoidal Rule
3. Simpson’s Rule
2. Improper Integrals
1. Improper Integrals of Type 1
2. Improper Integrals of Type 2
10/11/2021 2
1. Approximate Integration:
Motivations
• Integration techniques can be applied to only certain
classes of (simple) functions
❖Many integrals cannot be evaluated by integration
techniques. Examples
1 2 2
sin x
0 1 x 1 dx,...
2
x x
e dx , dx , x
f ( x)dx f ( x )x,
a i =1
i −1 x =
n
f ( x)dx f ( x )x,
a i =1
i x =
n
f ( x)dx f ( x )x
b n
-Mid-point Rule: i
a i =1
xi −1 + xi b−a
xi = , x =
2 n
Trapezoidal Rule
Take average of left-end and right-end point rules gives us
1 n
b n
b−a
x = , xi = a + ix
10/11/2021
n 5
Example 1: Use the Trapezoidal Rule with n=5 to
approximate the integral
2
1
1 x dx
Solution
n = 5, a = 1, b = 2, and x = (2 − 1) / 5 = 0.2
2
1 0.2
1 x dx T5 = f (1) + 2 f (1.2) + 2 f (1.4) + 2 f (1.6) + 2 f (1.8) + f (2)
2
1 2 2 2 2 1
= 0.1 + + + + + 0.695635
1 1.2 1.4 1.6 1.8 2
10/11/2021 6
Example 2: Use the Midpoint Rule with n=5 to
approximate the integral
2
1
1 x dx
Solution
10/11/2021 8
Errors
10/11/2021 9
Error Bounds
Suppose |f ''( x) | K , a x b. If ET and EM are errors
in the Trapezoidal and Midpoint Rules, then
K (b − a ) 3
K (b − a ) 3
ET and EM
12n 2 24n 2
10/11/2021 10
K (b − a )3
|f ''( x) | K , a x b. It holds that ET
12n 2
Solution: 1 −1 2
f ( x) = , f '( x) = 2 , f "( x) = 3 | f "( x) | 2 for 1 x 2
x x x
Error Bound for Trapezoidal Rule gives:
2(1)3 2 1
| ET | 2
0.0001 n
2
n 40.8
12n 12(0.0001) 0.0006
10/11/2021
n = 41 will ensure the desired accuracy. 11
K (b − a )3
|f ''( x) | K , a x b. It holds that EM
24n 2
Solution: 1 −1 2
f ( x) = , f '( x) = 2 , f "( x) = 3 | f "( x) | 2 for 1 x 2
x x x
Error Bound for Midpoint Rule gives:
2(1)3 1
| EM | 2
0.0001 n 28.8675
24n 0.0012
10/11/2021
n = 29 will ensure the desired accuracy. 12
Simpson’s Rule
b−a
x0 = a x1 x2 ... xn = b, xi = a + ih, h =
n
i = 0,1, 2,..., n, n : even
b
h
f ( x)dx S n = f (a) + 4 ( f ( x1 ) + f ( x3 ) + ... + f ( xn −1 ) )
a
3
+ 2 ( f ( x2 ) + f ( x4 ) + ... + f ( xn − 2 ) ) + f (b)
10/11/2021 13
Example: Use Simpson’s Rule with n=10 to approximate
2
the integral 1
Solution
x dx
1
Putting f ( x) = 1/ x, n = 10, x = 0.1 in Simpson's Rule gives us
x
2
1
1 x dx S10 = 3 f (1) + 4 ( f (1.1) + f (1.3) + f (1.5) + f (1.7) + f (1.9) )
+ 2 ( f (1.2) + f (1.4) + f (1.6) + f (1.8) ) + f (2)
0.1 1 1 1 1 1 1
= + 4 + + + +
3 1 1.1 1.3 1.5 1.7 1.9
1 1 1 1
+ 2 + + + + f (2) 0.693150
1.2 1.4 1.6 1.8
Error = Es = 0.693147 - 0.693150 −0.000003
10/11/2021 14
Error Bounds
10/11/2021 15
K (b − a ) 5
Suppose |f (4) ( x) | K , a x b. Then ES 4
180n
Example: How large should we take n in2order to guarantee
that Simpson’s Rule approximation for 1 dx
is accurate to within 0.0001? 1
x
Solution: 1 (4) 24
f ( x) = , f ( x) = 5 | f (4) ( x) | 24 for 1 x 2
x x
Error Bound for Simpson’s Rule gives:
24(1)5 24 1
| ES | 4
0.0001 n
4
n 4 6.04
180n 180(0.0001) 0.00075
n = 8 (n must be even) gives the desired accuracy.
10/11/2021 16
2. Improper Integrals
10/11/2021 17
Definition of an Improper Integral of Type 1
t
a) If
a
f ( x)dx exists for every number t ≥ a, then
t
f ( x)dx = lim f ( x)dx
a
t →
a
2.
0
−
e dx = lim e dx = lim e
x
0
t
x
= lim e
x 0
t
0
− et = 1
t → − t → − t → −
1 0 1 1
3. dx = dx + dx
− 1 + x 2 − 1 + x 2 0 1+ x2
−1
= lim tan x t + lim tan x 0
0
−1
t
t → − t →
= lim − tan t + lim −1
tan t = − − + =
−1
t → − t → 2 2
All three integrals are convergent.
An example of a divergent integral:
1
Recall from the previous slide that 1 x 2
dx is convergent
1
1 x p
dx is convergent if p 1 and divergent if p 1
Definition of an Improper Integral of Type 2
a) If f is continuous on [a, b) and is discontinuous at b, then
b t
a
f ( x)dx = lim f ( x)dx
t →b −
a
1
0
2 x
1
dx = lim
+
1
t
1
2 x
dx = lim
+
x = lim 1 − t = 1
1
t
t →0 t →0 t →0 +
This integral is convergent.
Example 2:
dx
1
0 x 4
1 1
lim+ dx
2
1
b →0 b x
-1 0 1
1
lim+ ln x b -1
b →0
b) f ( x)dx is divergent, then g ( x)dx
a a
is divergent
b
10/11/2021 23