You are on page 1of 17

Numerical Integration

Trapezoidal Rule
Simpson’s 1/3 rule
Simpson’s 3/8 rule
11/8/2022 8:08:08 PM
Gauss Quadrature Method1
Numerical Integration
b
The problem of numerical integration is to evaluate  f  x dx
a
The problem arises when the integrand f  x  is not integrable or
f  x  is known at only at finite number of points.

This is based on the strategy of replacing a complicated function or


tabulated data with an approximating function that is easy to integrate.

The process of evaluating a definite integral from set of tabulated values of


the integrand f  x  is called numerical integration.
When this process is applied to function of single variable is called quadrature.

2
11/8/2022 8:08:08 PM
Trapezoidal Rule
b
The evaluation of integrand I   f  x dx by trapezoidal rule is geometrically
a
equivalent to approximating the area under straight line connecting f  a  and f  b  .

Thus the Trapezoidal rule is


b
I=  f  x  dx 
h
2
 
f  x0   f  xn   2  f  x1   f  x2   ...  f  xn1  
a

ba
Here h  , where n is the no. of sub intervals.
n

3
11/8/2022 8:04:25 PM
Example:-
1
Evaluate I=  e  x2
dx with n=10 by using Trapezoidal rule.
0
1
Ans : 
Given that I=  e  x2
dx. i.e. f ( x)  e  x2
a  0, b  1 and n  10.
0

b  a 1 0
So h    0.1.
n 10
Now using interval [a, b]  [0,1] with h  0.1, we have the following table:

x: x0 x1 x2 x3 x4 x5
x: 0 0.1 0.2 0.3 0.4 0.5
f ( x) : 1 0.99005 0.96079 0.91393 0.85214 0.7788

4
11/8/2022 8:04:25 PM
Continue..
x: x6 x7 x8 x9 x10
x: 0.6 0.7 0.8 0.9 1.0
f ( x) : 0.69768 0.61263 0.52729 0.44485 0.36788

Hence by Trapezoidal rule

0.1  0.99005  0.96079  0.91393  0.85214  0.7788  


1
I=  e x dx =  
2

1 0.36788 2   0.69768  0.61263  0.52729  0.44485 


0
2   

I  0.74621

5
11/8/2022 8:04:25 PM
Simpson’s 1/3 rule:
b
The Simpson’s one-third rule for integration  f  x  dx is given by
a

h f  x0   f  xn   4  f  x1   f  x3  ....  f  xn1  



b
I   f  x  dx   
2  f  x2   f  x4  ....  f  xn2  
3  
a 

ba
Here h  , where n is the no. of sub intervals.
n
Note:-
The Simpson’s 1/3 rule requires the interval  a, b  to be divided into an
even number of subintervals of width h.
i.e. n should be even.

6
11/8/2022 8:04:25 PM
Example:-
1
Evaluate I=  e  x2
dx with n=10 by using Simpson's 1/3 rule.
0
1
Ans : 
Given that I=  e  x2
dx. i.e. f ( x)  e  x2
a  0, b  1 and n  10.
0

b  a 1 0
So h    0.1.
n 10
Now using interval [a, b]  [0,1] with h  0.1, we have the following table:

x: x0 x1 x2 x3 x4 x5
x: 0 0.1 0.2 0.3 0.4 0.5
f ( x) : 1 0.99005 0.96079 0.91393 0.85214 0.7788

7
11/8/2022 8:04:25 PM
Continue..
x: x6 x7 x8 x9 x10
x: 0.6 0.7 0.8 0.9 1.0
f ( x) : 0.69768 0.61263 0.52729 0.44485 0.36788

Hence by Simpson's 1/3 rule

 0.99005  0.91393  0.7788 


0.1 1  0.36788  4  
1
I=  e dx =
 x2
  0.61263  0.44485 
3  
0
 2  0.96079  0.85214  0.69768  0.52729  

I  0.746924

8
11/8/2022 8:04:26 PM
Simpson’s 3/8 rule:
b
The Simpson’s 3/8 rule for integration  f  x  dx is given by
a
 f  x0   f  xn   
3h 
 

b
I   f  x  dx  3  f  x1   f  x2   f  x4   f  x5  ....  f  xn1   
8  
2  f  x3   f  x6   f  x9  ....  f  xn3  
a
 

ba
Here h  , where n is the no. of sub intervals.
n
Note:-
The no. of sub intervals for Simpson’s 3/8 rule should be
taken as multiples of 3.

9
11/8/2022 8:04:26 PM
Example:-

2
Evaluate I=  cos  d by using simpson's 3/8 rule with n=6.
0

Ans:- Given that f    cos  and a  0 and b  .
2
ba 
So h=  .
n 12
: 0 1 2 3 4 5 6
    5 
: 0
12 6 4 3 12 2
f   : 1 0.9828 0.9306 0.8409 0.7071 0.5087 0

2
3 
I=  cos  d =  1  0  3  0.9828  0.9306  0.7071  0.5087   2  0.8409
0
8 12

I  1.18491
10
11/8/2022 8:04:26 PM
Gauss Quadrature Method
Gauss quadrature is another method of evaluation of integral
b

 f ( x)dx, in which we need not the value of f  x  in spaced intervals.


a

The evaluation of integral doesn’t depends on the functional values


at fixed points.

Now we will discuss particular Gauss quadrature formulas


known as Gauss-Legendre formulas.
1) Two-point Gauss Legendre formula
2) Three Point Gauss-Legendre formulas
11
11/8/2022 8:27:07 PM
Continue…
To apply the Gauss quadrature formulas we need the integral
b

 f ( x)dx.........................(1)
a

1
in stanadard form
1
 f ( x)dx.........................(2)

If the integral 1 is not in standard form  2  , then it can be transformed to


standard form by putting
ba ba
x t   
 2   2 

After transfering the given integral to standard form we can use the
Gauss quadrature formulas as follow

12
11/8/2022 8:09:11 PM
Continue…
Two-point Gauss Legendre formula:-

 1   1 
1
I   f ( x)dx  f   f  
1  3   3 

Three-point Gauss Legendre formula:-

1
5  3 8 5  3
I   f ( x)dx  f     f  0  f 
1
9  5 9 9  5

13
11/8/2022 8:09:11 PM
Example:-
3
Obtain the integral  xe x dx using Two, Three-Point Gauss-Legendre formula.
0

Ans:- 3
Given integral is I=  xe x . This is not in standard form.
0

ba ba  30   3 0 


So we put x   t    i.e. x   t     1.5t  1.5
 2   2   2   2 

 dx  1.5dt
3 1 1
 I  2.25   t  1 e
1.5t 1.5
 I   xe x dx   1.5t  1.5  e
1.5t 1.5
1.5dt dt  2.25* I1
0 1 1

1
Here I1    t  1 e dt and f (t )   t  1 e
1.5t 1.5 1.5t 1.5

1

14
11/8/2022 8:09:11 PM
Continue…
So by Gauss-Legendre two point formulas, we have

 1   1 
1
I1    t  1 e 1.5t 1.5
dt  f   f 
1  3  3

 1   1 
 1  1.5 1  1  1.5  1
 I1    1 e 3 
  1 e 3 

 3   3 

 I1  16.807  0.797  17.604

 I  2.25* I1  2.25*17.604  39.608

15
11/8/2022 8:09:11 PM
Continue..
Similarly by Gauss-Legendre three point formulas, we have
1
5  3 8 5  3
I1    t  1 e 1.5t 1.5
dt  f     f  0  f 
1
9  5 9 9  5 

 I1  0.176  3.984  14.121  18.281

 I  2.25* I1  2.25*18.281  41.1328

16
11/8/2022 8:09:11 PM
Make Presentation much more fun

11/8/2022 8:04:26 PM 17

You might also like