Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Chapter 4: Integrals

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

• In many applications: Functions are in tabular form


• In both cases we need to find approximate values of
definite integrals.
10/11/2021 3
Mid-Point Rule
-Left endpoint Rule: xi −1 = a + (i − 1)x
b−a
b n

 f ( x)dx  f ( x )x,
a i =1
i −1 x =
n

-Right endpoint Rule: xi = a + ix


b−a
b 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

 f ( x)dx    f ( xi −1 )x +  f ( xi )x 


a
2  i =1 i =1 
x  n 
=  ( f ( xi−1 ) + f ( xi ) )
2  i =1
x
=  f ( x0 ) + 2 f ( x1 ) + + 2 f ( xn −1 ) + f ( xn ) 
2

Trapezoidal Rule is:


x
 a f ( x)dx  Tn = 2  f (a) + 2 ( f ( x1 ) + + f ( xn −1 ) ) + f (b) 
b

b−a
x = , xi = a + ix
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

The midpoints of the five subintervals are


1.1, 1.3, 1.5, 1.7, and 1.9, so the Midpoint Rule gives
2
1
1 x dx  M 5 = x  f (1.1) + f (1.3) + f (1.5) + f (1.7) + f (1.9)
 1 1 1 1 1 
= 0.2  + + + +   0.691908
 1.1 1.3 1.5 1.7 1.9 
10/11/2021 7
Errors in Approximating Integrals
In last Examples:
2
1
1 x dx = ln x 1 = ln 2 = 0.693147 ...
2

Errors: ET  0.002488 and EM  0.001239

In general, errors are defined by:


b b
ET =  f ( x)dx − Tn and EM =  f ( x)dx − M n
a a

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

Example 1: How large should we take n in order to guarantee


2
that the Trapezoidal Rule approximation for 1
is accurate to within 0.0001? x
dx 
1

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

Example 2: How large should we take n in order to guarantee


2
that the Midpoint Rule approximation for 1
is accurate to within 0.0001? x
dx 
1

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

Suppose |f (4) ( x) | K , a  x  b. If ES is the error


in Simpson's Rule, then
K (b − a )5
ES  4
180n

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

•Improper Integrals of Type 1


•Improper Integrals of Type 2

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

provided this limit exists (as a finite number).


b
b) If t f ( x)dx exists for every number t ≤ b, then
b b

−
f ( x)dx = lim f ( x)dx
t → −
t

provided this limit exists (as a finite number).


 b
The improper integrals  f ( x)dx and  f ( x)dx are called
a −
convergent if the corresponding limit exists and divergent
if the limit does not exist.
a 
c) If both − f ( x)dx and  f ( x)dx are convergent, then we define
a
 a 

−
f ( x)dx =  f ( x)dx +  f ( x)dx
− a
Examples
t
 1 1 t  1  1 1
1. 1 x 2
dx = lim  2 dx = lim −  = lim − +  = 1
t →
1 x
t →  x 1 t →  t 1

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:

dx = lim  dx = lim ln x 1 = lim ln t − ln 1 = 


 1 t 1

t
1 x t →
1 x
t → t →

 1
Recall from the previous slide that 1 x 2
dx is convergent

The general rule is the following:

 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

if this limit exists (as a finite number).


b) If f is continuous on (a, b] and is discontinuous at a, then
b b

a
f ( x)dx = lim f ( x)dx
t →a +
t

if this limit exists (as a finite number).


b
The improper integral f ( x)dx is called convergent if the
a
corresponding limit exists and divergent if the limit does
not exist.
c) If f has a discontinuity at c, where a < c < b, and both
c
 f ( x)dx
b
a
and

c
f ( x)dx are convergent, then we define
b c b

a
f ( x)dx =  f ( x)dx +  f ( x)dx
a c
Example 1:


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

lim+ ln1 − ln b = This integral is divergent.


b →0
Comparison Theorem for Improper Integrals of Type 1:
Let 0  f ( x)  g ( x), x  a. Then,
 
a)  g ( x)dx is convergent, then  f ( x)dx
a a
is convergent

 
b)  f ( x)dx is divergent, then  g ( x)dx
a a
is divergent

b 

Similar result holds for 


−
f ( x)dx and 
−
f ( x)dx

and for Improper Integral of Type 2

10/11/2021 23

You might also like