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

Integration

4.6 NUMERICAL
INTEGRATION
Objectives

 Approximate a definite integral using the Trapezoidal


Rule.

 Approximate a definite integral using Simpson’s Rule.

 Analyze the approximate errors in the Trapezoidal


Rule and Simpson’s Rule.

3
The Trapezoidal Rule
The Trapezoidal Rule
• Some elementary functions simply do not have antiderivatives
that are elementary functions.

• For example, there is no elementary function that has any of the


following functions as its derivative.

• If you need to evaluate a definite integral involving a function


whose antiderivative cannot be found, then while the
Fundamental Theorem of Calculus is still true, it cannot be
easily applied.

5
The Trapezoidal Rule
• In this case, it is easier to resort to an approximation technique.
Two such techniques are described in this section.

• One way to approximate a definite integral is to use


n trapezoids, as shown in Figure 4.42.

The area of the region can be approximated using four trapezoids.


Figure 4.42
6
The Trapezoidal Rule
• In the development of this method, assume that f is continuous
and positive on the interval [a, b]. So, the definite integral

• represents the area of the region bounded by the graph of f and


the x-axis, from x = a to x = b. First, partition the interval [a, b]
into n subintervals, each of width
x = (b – a)/n, such that

• a = x0 < x1 < x2 < . . . < xn = b.

7
The Trapezoidal Rule
• Then form a trapezoid for each subinterval (see Figure 4.43).

• The area of the i th trapezoid is

• This implies that the sum of the areas of


the n trapezoids is
Figure 4.43

8
The Trapezoidal Rule

•Letting x = (b – a)/n, you can take the limit as n → ∞ to obtain

9
Note :

ba
   f  x0   2 f  x1   2 f  x2     2 f  xn1   f  xn  
 2n 
ba
   f  x0   2 f  x1   2 f  x2     2 f  xn1   2 f  xn   f  xn  
 2n 

 b  a  n

   f  x0   f  xn   2 f  xn  
 2n   i 1 

x  n
 ba
  f  a   f  b   2 f  xn    x
2  n
i 1 
f  a   f b n
   f  xn  x
2 i 1
10
The Trapezoidal Rule

•The result is summarized in the following theorem.

11
Example 1 – Approximation with the Trapezoidal Rule

•Use the Trapezoidal Rule to approximate


•Compare the results for n = 4 and n = 8, as shown in Figure 4.44.

Four subintervals Eight subintervals


Figure
Trapezoidal 4.44
approximations

12
Example 1 – Solution
•When n = 4, x =  /4, and you obtain

13
Example 1 – Solution
cont’d

• When n = 8, x =  /8, and you obtain

• For this particular integral, you could have found an


antiderivative and determined that the exact area of the region is
2.
14
The Trapezoidal Rule
• It is interesting to compare the Trapezoidal Rule with the
Midpoint Rule.

• For the Trapezoidal Rule, you average the function values at the
endpoints of the subintervals, but for the Midpoint Rule, you
take the function values of the subinterval midpoints.

Midpoint Rule

Trapezoidal Rule

15
Simpson’s Rule
Simpson’s Rule
• One way to view the trapezoidal approximation of a definite
integral is to say that on each subinterval, you approximate
f by a first-degree polynomial.

• In Simpson’s Rule, named after the English mathematician


Thomas Simpson, you take this procedure one step further and
approximate f by second-degree polynomials.

17
Simpson’s Rule
• Before presenting Simpson’s Rule, consider the next theorem for
evaluating integrals of polynomials of degree 2 (or less).

18
Integrals of polynomials of degree 2
b
 Ax Bx 
3 2
 
b b
a p  x dx   Ax  Bx  C dx  
2
  Cx 
a
 3 2 a



A b3  a 3

 
B b2  a 2 
 C b  a 
3 2



2 A  b  a  b 2  ab  a 2   3B  b  a  b  a   6C b  a 
6 6 6
 b  a 

 6 
 2 A a 2
 
ab  b 2

 3B  b  a   6C 

 
2 Aa 2  2 Aab  2 Ab 2   3Bb  3Ba   6C

 ( Aa 2

 Ba  C )  Aa 2  2 Aab  Ab 2  ( Ab 2  Bb  C )   2 Bb  2 Ba   4C
19
Integrals of polynomials of degree 2

( Aa 2  Ba  C )  Aa 2  2 Aab  Ab 2   2 Bb  2 Ba   4C  ( Ab 2  Bb  C )

( Aa 2  Ba  C )  A(a 2  2ab  b 2 )  2 B  b  a   4C  ( Ab 2  Bb  C )

( Aa 2  Ba  C )  A(a  b) 2  2 B  b  a   4C  ( Ab 2  Bb  C )

 
2
 ab 
 2
 
Aa  Ba  C  4  A 
a b 
  B    C   A
b 2
 Bb  C 
  2   2  

pa  ab
4 p p b 

 2 
20
Integrals of polynomials of degree 2
b
 Ax Bx 3
 2
 
b b
a p  x dx   Ax  Bx  C dx  
2
  Cx 
a
 3 2 a



A b3  a 3


B b2  a 2 
 C b  a 
3 2



2 A  b  a  b 2  ab  a 2   3B  b  a  b  a   6C b  a 
6 6 6
 b  a 

 6 
 2 A a 2
 
ab  b 2

 3B  b  a   6C 

So we can get

b  b  a  ab 
a p  x dx     p a  4 p   p  b 
 6   2  
21
Simpson’s Rule

Figure 4.45

22
Proof of Simpson’s Rule

Partition the interval [a,b] into n subintervals, n is required to be even

a  x0  x1  x2  x3  x4    xn2  xn1  xn  b

 x0 , x2   x2 , x4   xn2 , xn 
x2 x2
x f  x dx  x p  x dx
0 0

 x2  x0    x0  x2  
   p  x0   4 p    p  x2  
 6   2  
2  b  a  n 
  p  x0   4 p  x1   p  x2 
6
ba
  f  x0   4 f  x1   f  x2  
3n 23
Proof of Simpson’s Rule

a  x0  x1  x2  x3  x4    xn2  xn1  xn  b
 x0 , x2   x2 , x4   xn2 , xn 
x4 x2 x4
x f  x dx  x p  x dx  x p  x dx
0 0 2

ba

3n
 
 f  x0   4 f  x1   f  x2   +  f  x2   4 f  x3   f  x4  

ba
  f  x0   4 f  x1   2 f  x2   4 f  x3   f  x4  
3n
Repeating the procedure on the entire interval [a,b] produce the Simpson’s Rule

24
Simpson’s Rule

The coefficients in the Simpson’s Rule have the following pattern.


1 4 2 4 2 4 . . . 4 2 4 1

25
Simpson’s Rule
•In Example 1, the Trapezoidal Rule was used to
•estimate

•In the next example, Simpson’s Rule is applied to the same


•integral.

26
Example 2 – Approximation with Simpson’s Rule

• Use Simpson’s Rule to approximate

• Compare the results for n = 4 and n = 8.

• Solution
• When n = 4, you have

• When n = 8, you have

27
Error Analysis
Error Analysis
• When you use an approximation technique, it is important to
know how accurate you can expect the approximation to be.

• The next theorem, gives the formulas for estimating the errors
involved in the use of Simpson’s Rule and the Trapezoidal Rule.

• In general, when using an approximation, you can think of the


error E as the difference between and the
approximation.

29
Error Analysis

• Theorem 4.20 states that the errors generated by the Trapezoidal


Rule and Simpson’s Rule have upper bounds dependent on the
extreme values of f”(x) and f(4)(x) in the interval [a, b].

30
Error Analysis
• Furthermore, these errors can be made arbitrarily small by
increasing n, provided that fand f (4) are continuous and
therefore bounded in [a, b].

31
Example 3 – The Approximate Error in the Trapezoidal Rule

• Determine a value of n such that the Trapezoidal Rule will


approximate the value of with an error that is less
than or equal to 0.01.

• Solution
• Begin by letting and finding the second
derivative of f.

• and

• The maximum value of |f(x)| on the interval [0,1] is |f(0)| = 1.

32
Example 3 – Solution
cont’d

• So, by Theorem 4.20, you can write

• To obtain an error E that is less than 0.01, you must choose n


such that

• 1/(12n2)  1/100.

• 100  12n2 n  2.89


 2.89
33
Example 3 – Solution
cont’d

• So, you can choose n = 3 (because n


must be greater than or equal to 2.89)
and apply the Trapezoidal Rule, as
shown in Figure 4.46, to obtain

Figure 4.46

34
Example 3 – Solution
cont’d

• So, by adding and subtracting the error from this estimate,


• you know that

35

You might also like