Numerical Integration
Numerical Integration
Numerical Integration: The process of computing the value of a definite form a set of
numerical values of the integrand is called numerical integration.
Let f(x) be given for certain equidistant value of x = x0, x0 + h, x0 + 2h........x0 + nh.
Suppose y0 , y1 , y2 ,..... yn are the entries corresponding to the arguments
x0 = a, x1 = a + h, x2 = a + 2h........xn = a + nh = b.
b x0 + nh
I = ydx = y x dx.
a x0
x − x0
we know u = x = x0 + uh
h
Limit ; when x = x0 then u = 0 and x = x0 + nh then u = n
x0 + nh
u (u − 1) 2 u (u − 1)(u − 2) 3 u (u − 1)(u − 2)....(u − (n − 1)) n
n n
I =
x0
y x dx = y x0 +uh hdu = h y0 + u y0 +
0 0
2!
y0 +
3!
y0 + ..... +
n!
y0 du
n2 n3 n 2 2 y0 n 4 3 y0
= h ny0 + y0 + − + − n3 + n 2 + ..... ........ (1)
2 3 2 2! 4 3!
This is the general quadrature formula or Newton-Cotes closed quadrature formula.
Trapezoidal Rule:
Putting n=1 in the formula (1) and neglecting the second and higher order difference, we get
x1 = x0 + h
1 1 1
ydx = h y0 + y0 = h y0 + ( y1 − y0 ) = h ( y0 + y1 )
x0 2 2 2
x2 = x0 + 2 h
1
similarly , ydx = h ( y1 + y2 )
x1 = x0 + h
2
.....................................................
......................................................
xn = x0 + nh
1
ydx = h ( yn −1 + yn )
xn−1 = x0 + ( n −1) h
2
Adding nth integral, we get
x0 + nh x
1
n
1
I= ydx = ydx = h y0 + 2( y1 + y2 + y3 + .... + yn−1 ) + yn = h ( y0 + yn ) + ( y1 + y2 + y3 + .... + yn −1 )
x0 x0
2 2
which is known as the trapezoidal rule.
Simpson,s One-third Rule:
Putting n=2 in the equation(1) and neglecting the third and higher difference, we get
8
x0 + 2 h − 2
ydx = h 2 y0 + 2y0 +
3 2 y = h 2 y + 2( y − y ) + 1 y − 2 y + y = 1 h y + 4 y + y
0 0 1 0 ( 2 1 0 ) ( 0 1 2)
x0 2 3 3
x0 + 4 h
1
similarly ydx = h ( y2 + 4 y3 + y4 )
x0 + 2 h
3
.................................................................
..................................................................
x0 + nh
x0 + ( n − 2 ) h
1
(
ydx = h y( n − 2) + 4 y( n −1) + yn
3
) where n is even
Adding all , we get
x0 + nh
1
ydx = h ( y0 + yn ) + 4 ( y1 + y3 + ... + yn −1 ) + 2 ( y2 + y4 + .... + yn − 2 )
x0
3
This formula is known as simpson,s one-third rule.
Simpson,s Three-eight,s Rule:
Putting n=3 in the equation(1) and neglecting the forth and higher difference, we get
x0 + 3 h
9 27 9 y0 81
2
y0
3
9 9 3
ydx = h 3 y0 + y0 + − + − 27 + 9 = h 3 y0 + ( y1 − y0 ) + ( y2 − 2 y1 + y0 ) + (
x0 2 3 2 2! 4 3! 2 4 8
3h
= ( y0 + 3 y1 + 3 y2 + y3 )
8
x0 + 6 h
3h
similarly, ydx = ( y3 + 3 y4 + 3 y5 + y6 )
x0 + 3 h
8
.........................................................................
...........................................................................
x0 + nh
3h
ydx = ( yn−3 + 3 yn−2 + 3 yn−1 + yn )
x0 + ( n −3) h
8
Adding all , we get ;
x0 + nh
3h
ydx = ( y0 + yn ) + 3 ( y1 + y2 + y4 + y5 + y7 + ... + yn −1 ) + 2 ( y3 + y6 + .... + yn −3 )
x0
8
This formula is known as simpson,s three-eight rule.
Weddle,s Rule:
Putting n=6 in the equation(1) and neglecting the seven and higher difference, we get
x0 + nh
3
ydx = h y0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + 2 y6 + 5 y7 + y8 + ....
x0
10
This is known as weddie,s rule.
Question:
1
1
1. Find 1+ x
0
2
dx by using Trapezoidal Rule, Simpson,s One-third Rule, Simpson,s Three-eight Rule and
weddle,s rule. Also find the error each case. Hence obtain the approximate value of π in each case.
Solution:
Solution:
1
Let y = ; here a = 0 and b = 1 ,we shall divided the interval into six equal parts.
1 + x2
b − a 1− 0 1
Hence h = = = .
n 6 6
Now we find the value of y for each point of sub-division are given below:
x 1
y=
1 + x2
x0 = 0 y0 = 1
1 y1 = 0.97297297
x1 = x0 + h =
6
2 y2 = 0.9
x2 = x0 + 2h =
6
3
x3 = x0 + 3h = y3 = 0.8
6
4
x4 = x0 + 4h = y4 = 0.69230769
6
5
x5 = x0 + 5h =
6 y5 = 0.59016393
x6 = x0 + 6h = 1 y6 = 0.5
(1) By using Trapezoidal rule, we have
1 1
1 1
I = ydx = dx = h ( y0 + y6 ) + 2( y1 + y2 + y3 + y4 + y5 )
0 0
1+ x 2
2
2nd part:
1
1
1+ x
1
2
dx = tan −1 x = tan −1 1 − tan −1 0 =
0
0 4
22
Error = − 0.78422077 = − 0.78422077 = 0.00149351( Ans ).
4 74
3rd part:
By actual integration
1
1
0 1 + x 2 dx = tan x 0 = tan 1 − tan 0 = 4
−1 1 −1 −1
= 0.78424077
4
= 4 0.78424077 = 3.13696306( Approximate)
2nd part:
1
1
0 1 + x 2
1
dx =
tan −1
x −1 −1
0 = tan 1 − tan 0 = 4
22
Error = − 0.78539952 = − 0.78539952 = 0.00031476( Ans ).
4 74
3rd part:
By actual integration
1
1
0 1 + x 2 dx = tan x 0 = tan 1 − tan 0 = 4
−1 1 −1 −1
= 0.78539952
4
= 4 0.78539952 = 3.14159808( Approximate)
(3) By Simpson’s 3/8 rule, we get
1 1
1 3h
ydx = 1 + x dx = ( y0 + y6 ) + 3 ( y1 + y2 + y4 + y5 ) + 2 ( y3 )
0 0
2
8
2nd part:
1
1
0 1 + x 2 dx = tan x 0 = tan 1 − tan 0 = 4
−1 1 −1 −1
22
Error = − 0.78539586 = − 0.78539586 = 0.00031842( Ans ).
4 74
3rd part:
By actual integration
1
1
0 1 + x 2 dx = tan x 0 = tan 1 − tan 0 = 4
−1 1 −1 −1
= 0.78539586
4
= 4 0.78539586 = 3.14158344( Approximate)
2nd part:
1
1
1+ x
1
2
dx = tan −1 x = tan −1 1 − tan −1 0 =
0
0 4
22
Error = − 0.78539961 = − 0.78539961 = 0.00031467( Ans ).
4 74
3rd part:
By actual integration
1
1
0 1 + x 2 dx = tan x 0 = tan 1 − tan 0 = 4
−1 1 −1 −1
= 0.78539961
4
= 4 0.78539961 = 3.14159844( Approximate)
1
1
2. Compute the integral
0 1 + x2
dx correct to three decimal places by (i)Trapezoidal rule;
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
5.2
3. Compute the integral ln xdx correct to three decimal places by (i)Trapezoidal rule;
4
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
2
4. Compute the integral e dx correct to three decimal places by (i)Trapezoidal rule;
sin x
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
2
5. Compute the integral sin xdx correct to three decimal places by (i)Trapezoidal rule;
0
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
2
1
6. Compute the integral
0
1 − sin 2 tdt correct to three decimal places by (i)Trapezoidal
4
1 3
rule; (ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each
3 8
cases.
1
7. Compute the integral ( sin x + cos x )dx correct to three decimal places by
0
1 3
(i)Trapezoidal rule; (ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find
3 8
error for each cases.
1.4
8. Compute the integral ( sin x − ln x + e )dx correct to three decimal places by
x
0.2
1 3
(i)Trapezoidal rule; (ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find
3 8
error for each cases.
2
9. Compute the integral
0
cos xdx correct to three decimal places by (i)Trapezoidal rule;
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
1
1
10. Compute the integral dx correct to three decimal places by (i)Trapezoidal rule;
0
1+ x
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
3
1
11. Compute the integral dx correct to three decimal places by (i)Trapezoidal rule;
1
x
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
3
12. Compute the integral x dx correct to three decimal places by (i)Trapezoidal rule;
4
−3
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
1
1
13. Compute the integral dx correct to three decimal places by (i)Trapezoidal rule;
0
1 + x
1 3
(ii)Simpson,s rule; (iii)Simpson,s (iv)Weddle,s rule. Also find error for each cases.
3 8
Md.Nurul Alam
Lecturer(Mathematics)
Barishal Engineering College,Barishal.