Академический Документы
Профессиональный Документы
Культура Документы
Integration
Numerical integration is the approximate computation of integral using numerical techniques. The
numerical computation of an integral is sometimes called quadrature. Therefore, the basic problem in
numerical integration is to compute an approximate value to a definite integral
b
f ( x) dx
a
to a given degree of accuracy.
b
Meaning of f ( x) dx :
a
b b
The definite integral f ( x) dx y dx represents the area between the curve
a a
y f (x) , the x-axis and the lines
x a and x b .
numerically by using some well-established formulae or rules. The exact value of a definite integral
b
y f (x) cannot be exactly integrated in finite terms or the evaluation of its integral is too cumbersome,
integration can be more conveniently performed by numerical method. Various methods have been derived
to find the above area approximately, in this case when f (x) is not easily integrable. Hence these methods of
approximating an area are essential methods for approximating a definite integral. The developed
approximating methods are as follows:
i) Trapezoidal Rule
1
ii) Simpson’s Rule
3
3
iii) Simpson’s Rule
8
iv) Weddle’s Rule
v) Romberg’s Integration Rule
vi) Boole’s Rule etc.
equidistant values of x.
I ydx
a x0
------------------ (1)
u (u 1) 2 u (u 1)(u 2) 3
n
I y 0 uy 0 y0 y 0 upto (n 1)terms hdu
0
2! 3!
u (u 1) 2 u (u 1)(u 2) 3
n
h y 0 uy 0 y0 y 0 upto (n 1)terms du
0
2! 3!
n
(u 2 u ) 2 (u 2 u )(u 2) 3
h y 0 uy 0 y0 y 0 upto (n 1)terms du
0
2! 3!
n
(u 2 u ) 2 (u 3 3u 2 2u ) 3
h y 0 uy 0 y0 y 0 upto (n 1)terms du
0
2! 3!
n
u2 1 u3 u2 1 u4
h y0 u y 0 2 y 0 u 3 u 2 3 y 0 upto (n 1)terms
2 2! 3 2 3! 4 0
x0 nh
b
n 2
n 3
n y0 n
2 2 4
y0
3
I ydx ydx h ny 0 y 0 n 3 n 2 upto (n 1)terms
a x0 2 3 2 2! 4 3!
This Formula is known as general quadrature formula or General formula for numerical integration and also
known as General Gauss -Legendre integration formula for equidistant ordinates.
Note:
b
1. This formula is used to compute f ( x) dx
a
ydx y 0 y1
h
x0
2
ydx
h
y1 y2
x0 h
2
x0 3 h
ydx 2 y y3
h
2
x0 2 h
x0 nh
ydx 2 y yn
h
n 1
x0 ( n 1) h
x0 nh
The above formula is known as the trapezoidal rule for numerical integration.
Shortly we can write,
x0 nh
h n 1
x ydx 2 y 0 y n 2
k 1
yk
Md. Mehedi Hasan, Lecturer (Mathematics) @ DIU
0
Simpson’s1 Rule:
Simpson’s 3
Rule: 1
3
The general integration formula is
x0 nh
b
n2 n 3 n 2 2 y 0 n 4 2 y0
3
I ydx x ydx h
ny 0 y 0
3
2!
4 n 3
n
3! upto ( n 1)terms
a 0 2 2
Setting n 2 in above equation and neglecting the third and higher order, we get
x0 2 h
22 2 3 2 2 2 y 0
ydx h 2 y
0 2 y 0
3 2 2!
x0
2 y 0
h 2 y0 2 y1 y0 y1 y0
8 y0
2
1
h 2 y 0 2y 0 2 h 2 y 0 2y 0
3 2
3 3
h 2 y0 2 y1 y0 y2 y1 y1 y0 h 2 y0 2 y1 2 y0 y2 2 y1 y0
1 1
3 3
h
6 y0 6 y1 6 y0 y2 2 y1 y0
3
x0 2 h
ydx 3 y 4 y1 y 2
h
0
x0
ydx 3 y 4 y3 y 4
h
2
x0 2 h
x0 6 h
ydx 3 y 4 y5 y6
h
4
x0 4 h
x0 nh
ydx 3 y 4 y n 1 y n
h
n2
x0 ( n 2 ) h
x0 nh
x0 nh
h n1 n2
x ydx
0y y n 4 y k 2 y k
0
3 k 1, 3, 5 , k 2 , 4 , 6 ,
Note:
This formula is used only when the number of partitions of the interval of integration is even.
Simpson’s3 Rule:
3
Simpson’s 8Rule: 8
The general integration formula is
x0 nh
b
n2 n3 n 2 2 y 0 n 4 3 y 0
I ydx x ydx h ny
0 2 y 0 n 3 n 2 upto (n 1)terms
a 0 3 2 2! 4 3!
Setting n 3 in above equation and neglecting the fourth and higher order, we get
x0 3 h
32 33 3 2 2 y 0 3 4 2 y0
3
3
ydx h 3 y y 3 3 3
0 2 2 2! 4 3!
0
x0
9 9 3
h 3 y0 y0 2 y0 3 y0 0 0
3h 8 y 12y 62 y 3 y
0 0
2 4 8 8
3h
8 y0 12 y1 y0 6y1 y0 y1 y0
8
3h
8 y0 12 y1 y0 6 y2 2 y1 y0 y2 2y1 y0
8
3h
8 y0 12 y1 y0 6 y2 2 y1 y0 y3 y2 2 y2 y1 y1 y0
8
3h
8 y0 12 y1 12 y0 6 y2 12 y1 6 y0 y3 3 y2 3 y1 y0
8
x0 3 h
ydx 8 y 3 y1 3 y 2 y 3
3h
0
x0
ydx 8 y 3 y 4 3 y5 y6
3h
3
x0 3 h
x0 9 h
ydx 8 y 3 y 7 3 y8 y 9
3h
6
x0 6 h
ydx
3h
y n3 3 y n2 3 y n1 y n
x0 ( n 3 ) h
8
x 0 nh
ydx 8 y 3 y1 3 y2 y3 y3 3 y4 3 y5 y6 3h y6 3 y7 3 y8 y9 3h yn 3 3 yn 2 3 yn 1 yn
3h 3h
0
x0 8 8 8
3h
y0 3 y1 3 y2 y3 y3 3 y4 3 y5 y6 y6 3 y7 3 y8 y9 yn3 3 yn2 3 yn1 yn
8
x0 nh
x0 nh n 1 n 3
3h
x ydx 8 y 0 y n 3k 3,6,9,y k 2k 3, yk
6, 9,
0
k 1
Note: This formula is used only when the number of partitions of the interval of integration is a multiple of
the number 3.
Weddle’s Rule:
Similarly if we put n=6 in general integration formula then we get Weddle’s formula
x0 nh
3h
ydx
x0
10
[ y 0 5 y1 y 2 6 y3 y 4 5 y5 2 y 6 5 y 7 y8 ............]
x0 nh
3h n n 1 n 3
10 k 0,2,4,6,......k k 1
x0
ydx y 5
,3,5,
y k k y
k 3, 6,9
Note:
1.This formula requires at least seven consecutive values of the function.
2. This formula is used only when the number of partitions of the interval of integration is a multiple of the
number 6.
Md. Mehedi Hasan, Lecturer (Mathematics) @ DIU
Mathematical Problems
2
Problem 01: Compute x 2 dx by Simpson’s one third rule and compare with exact value.
1
Solution:
2
x dx
2
Given that the function is,
1
Here upper limit is b 2 , lower limit is a 1 and number of subintervals n 4 and let y f ( x) x 2
Now,
b a 2 1 1
h 0.25
n 4 4
The values of the function y at each subinterval are given in the tabular form:
x dx 3 y y 4 4 y1 y 3 2 y 2
2 h
0
1
0.25
1 4 41.5625 3.0625 2 2.25
3
2
7
x 2 dx
1
3
2
x3 1 3 3 7
Now exact value is x dx 2 1
2
2
1 3 1 3 3
1
It is shown that exact result and Simpson’s Rule’s result are exactly same so there is no error between two
3
results.
intervals six. Find true value and then compare and comment on it.
Solution:
5.2
Given that the function is, ln x dx
4
Here upper limit is b 5.2 , lower limit is a 4 and No. of subintervals n 6 and let y f ( x) ln x
Now,
5.2 4 1.2
h 0.2
6 6
The values of the function y at each subinterval are given in the tabular form:
x x0 4 x1 4.2 x2 4.4 x3 4.6 x4 4.8 x5 5.0 x6 5.2
y f ( x) ln x y 0 1.3862 y1 1.4350 y 2 1.4816 y3 1.5260 y 4 1.5686 y5 1.6094 y 6 1.6486
3 0.2
b
f ( x) dx 8
y0 y6 3 y1 y2 y4 y5 2 y3
a
3 0.2
b
f ( x) dx 8
1.3862 1.6486 3 1.4350 1.4816 1.5686 1.6094 2 1.5260
a
3 0.2
5.2
Weddle’s Rule:
We know that
x0 nh
3h n n 1 n 3
10 k 0,2,4,6,......k k 1
x0
ydx y 5
,3,5,
y k k y
k 3, 6,9
4 ln x dx k y 5 yk yk
10 k 0, 2, 4,6,...... k 1,3,5, k 3, 6,9
4 10
3 0.2
5.2
Or, ln x dx 6.085 5 4.5704 1.5260
4 10
5.2
ln x dx 1.82778
4
5.2 5.2
d
Exact value is 4 ln x dx x ln x 5.2
4
4 dx ln x dx dx
1 5.2
x ln x4 . x dx
5.2
4 x
5.2
x ln x4 dx
5.2
x ln x4 x4
5.2 5.2
1.4
sin x ln x e dx
x
Given that the function is,
0.2
Here upper limit is b 1.4 , lower limit is a 0.2 and No. of subintervals n6 and let
y f ( x) sin x ln x e . x
Now,
1.4 0.2
h 0.2
6
The values of the function y at each subinterval are given in the tabular form:
1.4
sin x ln x e dx
h
y x
0 y6 2 y1 y 2 y3 y 4 y5
0.2
2
0.2
3.0295 4.7041 22.7975 2.8975 3.1660 3.5597 4.0698
2
0.2
40.7136
2
1.4
sin x ln x e x dx 4.07136
0.2
1
Simpson’s Rule:
3
We know that
x0 nh
sin x ln x e dx 3 y
1.4
y 6 4 y1 y 3 y 5 2 y 2 y 4
h x
0
0.2
0.2
3.0295 4.7041 42.7975 3.1660 4.0698 22.8975 3.5597
3
1.4
sin x ln x e x dx
0.2
7.7336 40.1332 12.9144 4.05208
0.2
3
3
Simpson’s Rule:
8
We know that
x0 nh
3 0.2
b
f ( x) dx 8
y0 y6 3 y1 y2 y4 y5 2 y3
a
f ( x) dx 8
3.0295 4.7041 3 2.7975 2.8975 3.5597 4.0698 2 3.1660
a
3 0.2
b
f ( x) dx
a
8
54.0391
3 0.2
1.4
0.2
8
Weddle’s Rule:
We know that
b
3h n n1 n 3
a f ( x ) dx y 5
10 k 0, 2, 4,6,...... k 1,3,5,
k y k y k
k 3, 6 , 9
3 0.2
3.0295 2.8975 3.5597 4.7041 52.7975 3.1660 4.0698 3.1660
10
3 0.2
sin x ln x e dx 10 67.5233 4.051398
1.4
x
0.2
6
Example 04: Evaluate f ( x) dx
0
by using trapezoidal rule where the values of f ( x) are given by the
following table:
x 0 1 2 3 4 5 6
Y=f(x) 0.146 0.161 0.176 0.190 0.204 0.217 0.230
Solution:
Here upper limit is b 6 , lower limit is a 0 and No. of subintervals n 6 .
Now,
60
h 1
6
The values of the function y at each subinterval are given in the tabular form:
x x0 0 x1 1 x2 2 x3 3 x4 4 x5 5 x6 6
Y=f(x) y 0 0.146 y1 0.161 y 2 0.176 y3 0.190 y 4 0.204 y5 0.217 y 6 0.230
f ( x) dx 2 y y6 2 y1 y2 y3 y4 y5
1
0
a
b
f ( x) dx 1.136
0
Try Yourself
1. Derive newton’s general quadrature formula for numerical integration.
2. Obtain the formula for Simpson’s one-third rule from general quadrature formula.
3. Obtain the formula for Simpson’s rule and Weddle’s rule from general quadrature formula to find
b
f ( x) dx .
a
3
e
2 x
4. Using Simpson’s 3/8 th rule find the value of sin 4 x dx taking six sub-intervals.
0
1.8
1
5. Calculate the value of x x dx , correct up 5D taking six sub-intervals by Simpson’s 3/8 th
1.2
rule. Also, find the percentage errors and compare to the exact solution.
1
ln(1 x 2 )
6. Using Simpson’s 3/8 th rule find the value of 0 1 x 2 dx
2
7. Evaluate e 2 x sin 3x dx , using Simpson’s rule and Weddle’s rule.
0
sin x e dx
1.4
8. Using Simpson’s three-eight rule evaluate the integrals 2x
and hence find the errors.
0.2
Simpson’s 1/3 rule and trapezoidal rule. Find the exact value of I and then compare and comment on
it.
1
dx
11. Find 1 x
0
2
by using Simpson’s 1/3 and 3/8 rules. Hence obtain the approximate value of π in
each case.