Lecture -5
(Numerical Integration)
• Teacher’s Name • Dr. Sushil Shukla
• Department Name • Mathematics
• University Name • VBS Purvanchal
University Jaunpur
• Teacher’s Mob No. • 6387987133
• Teacher’s Email id • sushilcws@gmail.com
• Declaration : • The study material
provided in this
lecture is original.
Chapter
5
Numerical Integration
Numerical integration is the process of evaluating a definite
integral from the values of the function given in tabular form
and when this process is applied to the integration of a function
of single variable, and then the process is called quadrature.
The numerical integration of the tabulated value is solved by
representing f(x) by an interpolation formula and then
integrating it between the given intervals.
A General quadrature formula:
b
Let I = ∫ f ( x)dx
a
Where f(x) is obtained by an interpolation formula in the
interval (a, b) which is divided into n sub-intervals of equal
width h. Let x0= a, x1=a + h, x2=a + 2h ............... xn = a+ nh =
b and corresponding values of f(x) be y0, y1, y2 ........ yn.
The number of ordinates is (n+1).
x − x0 dx
If y = f(x) = f(x0+ph) then =p ⇒ = dp ⇒ dx = hdp
h h
By Newton's forward interpolation formula
p ( p − 1) 2 p ( p − 1)(p − 2) 3
y = y0 + p ∆ y0 + ∆ y0 + ∆ y 0 + ...............
2! 3!
62 A Text Book of Numerical Technique
Integrating both sides.
x0 + nh n
p ( p − 1) 2 p ( p − 1)(p − 2) 3
∫
x0
ydx = ∫ y0 + p∆y0 +
0
2!
∆ y0 +
3!
∆ y0 +
p ( p − 1)(p − 2)(p − 3) 4 p ( p − 1)(p − 2)(p − 3)(p − 4) 5
+ ∆ y0 + ∆ y0 +
4! 5!
p ( p − 1)(p − 2)(p − 3)(p − 4)(p − 5) 6
+ ∆ y0 + ......... hdp
6!
n
p2 − p 2 p3 −3p2 + 2 p 3
= n∫ y0 + p∆y0 + ∆ y0 + ∆ y0 +
0
2! 3!
1 1
+(p4 − 6 p3 +11p2 − 6 p) ∆4 y0 + (p5 −10 p4 + 35p3 −50 p2 + 24 p) ∆5 y0 +
24 120
1 6
+(p6 −15p5 +85p4 − 2253 + 274 p2 −120 p) ∆ y0 +......... dp [x0 = 0]
720
On integrating with respect to p we get,
p2 p3 p2 2 p4 3
3
2 ∆ y0
= h py 0 + ∆ y0 + − ∆ y 0 + − p + p
2 6 4 4 6
p 5 3 p 4 11 p 3 ∆ 4 y0
+ − + − 3 p2
5 2 3 24
p6 35 p 4 50 p 3 ∆ 5 y0
+ − 2 p5 + − + 12 p 2
6 4 3 120
n
p 7 15 p 6 225 p 4 274 p 3 ∆ 6 y0
+ − + 17 p 5 − + − 60 p 2 + ............
7 6 4 3 720 0
Numerical Integration 63
On Putting p = n, we get
n2 n3 n 2 n4 ∆ 3 y0
= n ny0 + ∆y0 + − ∆ 2 y0 + − n3 + n 2
2 6 4 4 6
n5 3n 4 11n3 ∆ 4 y0
+ − + − 3n 2
5 4 3 24
5
(1)
n6 5 35n 4 50n3 2 ∆ y0
+ − 2n + − + 12n
6 4 3 120
n 7 15n 6 225n 4 274n3 ∆ 6 y0
+ − + 17 n 5 − + − 60n 2 + ............
6 6 4 3 720
This is Newton-cotes quadrature formula and from this we
deduce different quadrature rules by taking n = 1, 2, 3,
6..................
Trapezoidal Rule:
We have to find the area of the region ABCD by trapezoidal
Rule. Base AB is divided into n equal parts. First of all we find
out the area of the Ist division and then area of the remaining
divisions.
On taking n = 1, in the equation (1) the figures will be a
trapezium and the curve will be a straight line passing through
(x0, y0) and (x1, y1) and other integrals will be zero.
Putting n = 1 in (1)
x0 + h
1 1
∫
x0
f ( x)dx = h y0 + ∆y0 = h y0 + ( y1 − y0 )
2 2
y y h
= h 0 + 1 = [ y0 + y1 ] .........(1)
2 2 2
64 A Text Book of Numerical Technique
Similarly
x0 + 2 h
h
∫ f ( x) dx = [ y1 + y2 ]
x0 + h
2
x0 + 3 h
h
∫ f ( x) dx = [ y2 + y3 ]
x0 + 2 h
2
........................................
........................................
x0 + nh
h
∫ f ( x )dx = [ yn −1 + yn ]
x0 + ( n −1) h
2
On adding above n integrals, we get
x0 + h x0 + 2 h x0 + 3 h x0 + nh
∫
x0
f ( x ) dx + ∫
x0 + h
f ( x ) dx + ∫
x0 + 2 h
f ( x ) dx + ............ + ∫
x0 + ( n −1) h
f ( x ) dx
h
= [( y0 + y1 ) + ( y1 + y2 ) + ( y2 + y3 ) + .......... + ( yn−1 + yn )]
2
h
= [ ( y0 + yn ) + 2( y1 + y2 + y3 + .......... + yn −1 ) ]
2
x0 + nh
So h
∫ f ( x)dx = [ ( y0 + yn ) + 2( y1 + y2 + .......... + yn−1 )]
x0
2
π
2
Problem: Calculate an approximate value of ∫ Sinx dx by
0
Trapezoidal rule.
Numerical Integration 65
π
Solution: We divide the range 0, into ten equal parts, so
2
π
h=
20
x 0 π π 3π π π 3π
20 10 20 5 4 10
Sin x 0.00 0.1564 0.3090 0.4540 0.587 0.7071 0.8090
60 8
y0 y1 y2 y3 y4 y5 y6
x 7π 2π 9π π
20 5 20 2
Sin x 0.89 0.9511 0.9877 1.0000
10
y7 y8 y9 y10
Using Trapezoidal rule, approximate value is
π
2
1
∫ Sinx dx = h 2 ( y
0
0 + y10 ) + ( y1 + y2 + ........ + y9 )
π 1
= (0 + 1) + 0.1564 + 0.3090 + 0.4540 + 0.5878
20 2
+ 0.7071 + 0.8090 + 0.8910 + 0.9511 + 0.9877 }
π
= (0.5 + 5.8531) = 0.9979 [π = 3.141592654]
20
Simpson's One Third Rule:
On putting n = 2 in (1), the curve through (x0, y0), (x1, y1) and
(x2, y2) is a parabola (Polynomial of 2nd degree) and other
integrals vanish.
x0 + 2 h
(2)2 23 22 2
So ∫ f ( x)dx = h 2 y0 + ∆ y0 + − ∆ y0
x0 2 6 4
66 A Text Book of Numerical Technique
4
= h 2 y 0 + 2 ( y1 − y 0 ) + − 1 ( ∆ y 1 − ∆ y 0 )
3
1
= h 2 y 0 + 2 y1 − 2 y 0 + { y 2 − y 1 − ( y 1 − y 0 ) }
3
1 1 1
= h 2 y 0 + 2 y1 − 2 y 0 + y2 − y1 + y0
3 3 3
1 4 1
= h y0 + y1 + y2
3 3 3
x + 2 h
0
h
So, ∫ f ( x )d x = [y 0 + 4 y1 + y 2 ]
x 0
3
Similarly
x0 + 4 h
h
∫ f ( x)dx = [y2 + 4 y3 + y4 ]
x0 + 2 h
3
x0 + 6 h
h
∫ f ( x)dx = [y4 + 4 y5 + y6 ]
x0 + 6 h
3
......................................................
......................................................
x0 + n h
h
∫ f ( x)dx = [yn−2 + 4 y n −1 + y n ]
x0 + ( n − 2 ) h
3
Adding we get.
x0 + 2 h x0 + 4 h x0 + 6 h x0 + nh
∫
x0
f ( x ) dx + ∫
x0 + 2 h
f ( x ) dx + ∫
x0 + 6 h
f ( x ) dx + ............. + ∫
x0 + ( n − 2 ) h
f ( x ) dx
h
= [ ( y0 + 4 y1 + y2 ) + ( y2 + 4 y3 + y4 ) + ( y4 + 4 y5 + y6 ) + ............. + ( yn−2 + 4 yn−1 + yn )]
3
Numerical Integration 67
So
x0 +nh
h
∫ f ( x)dx = [ ( y0 + yn ) + 2( y2 + y4 + y6 + ...... + yn−2 ) + 4( y1 + y3 + y5 + ...... + yn−1)]
x0
3
h
So ∫ f ( x)dx = ( y0 + yn) + 2 ∑ ye + 4 ∑ y 0
3
Geometric Proof:
+n n
Area APQC = ∫ ydy = ∫ (ax
2
+ bx + c)dx
−n −n
n
ax3 bx 2 2h
= + + cx = (ah 2 + 3c)
3 2 −n 3
A (-h, y0), B (0, y1), C (h1, y2) lie on parabola.
y0 = ah 2 − bh + c
y1 = c
y2 = ah 2 + bh + c
y0 + y2 = 2ah2 + 2c = 2ah 2 + 2 y1
So, ⇒ 2ah 2 = y0 + y2 − 2 y1
1
⇒ ah 2 = ( y0 + y2 − 2 y1 )
2
2h 1
So, APQC = ( y0 + y2 − 2 y1 ) + 3 y1
3 2
h
= [ y0 + y2 − 2 y1 + 6 y1 ]
3
h
= [ y0 + 4 y1 + y2 ] so on
3
h
So, CQ RS = [ y2 + 4 y3 + y4 ].........................
3
A = APQC + CQRS + ..............
h
So, Area = [× + 2 E + 40]
3
68 A Text Book of Numerical Technique
Problem: Calculate by Simpson's rule an approximate value of
3
∫ x dx
4
by taking seven equidistance intervals.
−3
Solution: The seven equidistance intervals are -3, - 2, -1, 0 1, 2,
3 and the length of each interval is 1
x -3 -2 -1 0 1 2 3
4
Y =x 81 16 1 0 1 16 81
y0 y1 y2 y3 y4 y5 y6
x0 + 6 h
h
So, ∫ ydx = [ ( y0 + y6 ) + 2( y2 + y4 ) + 4( y1 + y3 + y5 ) ]
x0
3
3
1
∫ x dx = 3 [(81 + 81) + 2(1 + 1) + 4(16 + 0 + 16) ]
4
x0
1 1
= [162 + 4 + 128] = × 294 = 98
3 3
3
So Approximate value of is ∫x
4
dx 98.
−3
Simpson's Three eight Rule:
On putting n = 3 in (1), we consider three strips at a time.
The curve passes through (x0, y0), (x1, y1), (x2, y2), (x3, y3).
Other integrals vanish.
x0 + 3h
∫
x0
f ( x)dx
3
32 27 9 2 81 ∆ y0
= h 3 y0 + ∆ y0 + − ∆ y0 + − 27 + 9
2 6 4 4 6
9 9 3
= h 3 y0 + ( y1 − y0 ) + (∆y1 − ∆y0 ) + (∆ 2 y1 − ∆ 2 y0 )
2 4 8
Numerical Integration 69
9 9 9 3
= h 3 y0 + y1 − y0 + [ y2 − y0 − ( y1 − y0 )] + (∆y2 − ∆y1 − ∆y1 + ∆y0 )
2 2 4 8
9 9 9 9 9 3
= h 3y0 + y1 − y0 + y2 − y1 + y0 + {( y3 − y2 ) − 2( y2 − y1 ) + ( y1 − y0 )}
2 2 4 2 4 8
3 9 3
= h y0 + y2 + ( y3 − y2 − 2 y2 + 2 y1 + y1 − y0 )
4 4 8
3 9 3 9 9 3
= h y0 + y2 + y3 − y2 + y1 − y0
4 4 8 8 8 8
3 9 9 3
= h y0 + y1 + y2 + y3
4 8 8 8
x0 + 3 h
3h
So, ∫ f ( x)dx = [ y0 + 3 y1 + 3 y 2 + 3 y 3 ]
x0
8
x0 + 6 h
3h
∫ f ( x)dx = [ y3 + 3 y4 + 3 y5 + 3 y6 ]
x0 + 3 h
8
x0 + 9 h
3h
∫ f ( x)dx = [ y6 + 3 y7 + 3 y8 + 3 y9 ]
x0 + 6 h
8
..................................................................
....................................................................
x0 + nh
3h
∫ f ( x)dx = [ yn−3 + 3 y n − 2 + 3 y n −1 + 3 y n ]
x0 + ( n − 3 ) h
8
Adding we get
x0 + nh
3h
∫ f ( x ) dx = [ ( y 0 + y n ) + 3( y1 + y 2 + y 4 + y5 + ....... + y n −1 )
x0
8
+ 2( y 3 + y 6 + y 9 + ....... + y n − 3 ) ]
70 A Text Book of Numerical Technique
Problem: A river is 80 meters wide. The depth d (in meters) of
the river at a distance x from the bank is given by
x 0 10 20 30 40 50 60 70 80
d 0 4 7 9 12 15 14 8 3
y0 y1 y2 y3 y4 y5 y6 y7 y8
Find approximately area of cross section of the river using
3
Simpson's Rule.
8
Solution:
80
3h
A= ∫ f ( x)dx = 10 [( y
0
0 + y8 ) + ( y1 + y2 + y4 + y5 + y7 ) + 2( y3 + y6 ) ]
30
= (87 ) = 701.25 sq. metres. approx
8
Weddle’s Rule:
On Putting n = 6 in (1), we get
x0 + 6 h
123 4
∫
x0
f ( x)dx = h 6 y0 + 18∆ y0 + 27 ∆ 2 y0 + 24∆ 3 y0 +
10
∆ y0
33 5 41 6
∆ y0 +
+ ∆ y0 ]
10 140
41 6 3
Taking ∆ y0 = ∆6 y0 (approx)
140 10
x0 + 6 h
9 2 123 4
∫x f ( x)dx = 6h y0 + 3∆y0 + 2 ∆ y0 + 4∆ y0 + 60 ∆ y0
3
11 5 1
+ ∆ y0 + ∆ 6 y0 ]
20 20
Putting ∆y0 = y1 − y0
∆2 y0 = ∆y1 − ∆ y0 = y2 − y1 − y1 + y0 = y2 − 2 y1 + y0
Numerical Integration 71
∆3 y0 = ∆( ∆2 y0 ) = ∆ ( y2 − 2 y1 + y0 )
= ( y2 − 2 y2 + y1 ) − ( y2 − 2 y1 + y0 )
= y3 − 3 y2 + 3 y1 − y0
∆4 y0 = ∆( ∆3 y0 ) = ∆( y3 − 3 y2 + 3 y1 − y0 )
= ( y4 − 3 y3 + 3 y2 − y1 ) − ( y3 − 3 y2 + 3 y1 − y0 )
= y4 − 4 y3 + 6 y2 − 4 y1 + y0
∆5 y0 = ∆( ∆4 y0 ) = ∆( y4 − 4 y3 + 6 y2 − 4 y1 + y0 )
= ( y5 − 4 y4 + 6 y3 − 4 y2 + y1 ) − ( y4 − 4 y3 + 6 y2 − 4 y1 + y0 )
= y5 − 5 y4 + 10 y3 − 10 y2 + 5 y1 − y0
∆6 y0 = ∆( ∆5 y0 ) = ∆( y5 − 5 y4 + 10 y3 − 10 y2 + 5 y1 − y0 )
= ( y6 − 5 y5 + 10 y4 − 10 y3 + 3 y2 − y1 ) − ( y5 − 5 y4 + 10 y3 − 10 y2 + 5 y1 − y0 )
= y6 − 6 y5 + 15 y4 − 20 y3 + 15 y2 − 6 y1 + y0
On putting these values, we get.
x0 + 6 h
9
∫
x0
f ( x)dx = 6h y0 + 3( y1 − y0 ) + ( y2 − 2 y1 + y0 )
2
123
+ 4( y3 − 3 y2 + 3 y1 − y0 ) + ( y4 − 4 y3 + 6 y2 − 4 y1 + y0 )
60
11
+ ( y5 − 5 y4 + 10 y3 − 10 y2 + 5 y1 − y0 )
20
1
+ ( y6 − 6 y5 + 15 y4 − 20 y3 + 15 y2 − 6 y1 + y0 )
20
72 A Text Book of Numerical Technique
9 41 11 1 41 11 3
= 6h 1 − 3 + − 4 + − + y0 + 3 − 9 + 12 − + − y1
2 20 20 10 5 2 10
9 123 11 3 41 11
+ − 12 + − + y2 + 4 − + − 1 y3
2 10 2 4 5 2
41 11 3 11 3 1
+ − + y4 + − y5 + y6
20 4 4 20 10 20
1 1 1 3 1 1 1
= 6h y0 + y1 + y2 + y3 + y4 + y5 + y6
20 4 20 10 20 4 20
Similarly
x0 +12 h
3h
∫ f ( x)dx = ( y6 + 5 y7 + y8 + 6 y9 + y10 + 5 y11 + y12 )
x0 + 6 h
10
.......................................................................
...........................................................................
x0 + nh
3h
∫ f ( x)dx = ( yn−6 + 5 yn −5 + yn −4 + 6 yn −3 + yn −2 + 5 yn −1 + yn )
x0 + ( n − 6) h
10
Adding, we get
3h
f ( x ) dx = ( y0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + 2 y6 + ........)
10
Remark: (1) Interval AB is divided into multiple of 6 sub-
divisions.
(2) Weddle’s Rule is more accurate than Simpson’s Rule.
1
dx
Problem: Evaluate ∫ (1 + x 2
by using
0
)
3
(1) Simpson's Rule (2) Weddle’s Rule.
8
And hence find value of π dividing range into 6 six equal parts.
Numerical Integration 73
1− 0 1
Solution: Here =
6 6
x 0 1 2 3 3
6 6 6 6
1 1.000 36 36 36 36
= 0.97297 = 0.97297 = 0.80000 = 0.69231
1 + x2 37 40 45 52
y0 y1 y2 y3 y4
3
By Simpson's Rule.
8
3h
∫ ydx = 8 [ ( y0 + yn ) + 3( y1 + y2 + y4 + y5 ) + 2( y3 + y6 )]
1
3 × (1 .0 0 0 + 0 .5 0 0 0 ) + 3(0 .9 7 2 9 7 + 0 .9 0 0 0 0
= 6
8 + 0 .6 9 2 3 1 + 0 .0 5 9 0 1 6 + 2 (0 .8 0 0 0 0 )
1
= [1 .5 0 0 0 0 + 3(3 .1 5 5 4 4 ) + 2 (0 .8 0 0 0 0 ) ]
16
1
= [1 2 .5 6 6 3 2 ] = 0 .7 8 5 3 9 5
16
1
dx π
= ( tan −1 x ) =
1
Again ∫ 2
0
(1 + x ) 0 4
π
So = 0.785395 ⇒ π = 3.14158
4
(2) By Weddle’s Rule.
3h
∫ ydx = 10 [ y 0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + y6 ]
1
3 × 1.0000 + 5(0.97297) + 0.90000 + 6(0.80000)
= 6
10 +0.69231) + 5(0.59016) + 0.50000
1
= [15.70796] = 0.785398
20
π
So = 0.785398 ⇒ π = 3.141592(approx) .
4
74 A Text Book of Numerical Technique
Problems: Find the distance between two stations from the
following data consisting of the speeds v(+) of an electric train
at various times t after leaving one station until it stops at the
next station. Apply Simpson’s Rule
(v) 0 13 33 39.5 40 40 36 15 0
(miles/hr)
t (min.) 0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
y0 y1 y2 y3 y4 y5 y6 y7 y8
Solution: Here h = 0.5
ds
If s (miles) be the distance covered in t (min), then =v
dt
4
h
⇒ [s] [( y0 + y8 ) + 2( y2 + y4 + y6 ) + 4( y1 + y3 + y5 + y7 )]
4
= ∫ vdt =
t =0
0
3
0.5 33 40 36 13 39.5 40 15
= (0 + 0) + 2 + + + 4 + + +
3 60 60 60 60 60 60 60
0.5 109 107.5
= 2× + 4 = 1.8miles.
3 60 60
Problem: Calculate by Simpson's rule an approximate value of
3
∫ x dx
4
by taking seven equidistance intervals.
−3
Solution: The seven equidistance intervals are -3, - 2, -1, 0 1, 2,
3 and the length of each interval is 1
x -3 -2 -1 0 1 2 3
4
Y =x 81 16 1 0 1 16 81
y0 y1 y2 y3 y4 y5 y6
Numerical Integration 75
x0 + 6 h
h
So, ∫ ydx = [( y 0 + y 6 ) + 2 ( y 2 + y 4 ) + 4 ( y1 + y 3 + y 5 ) ]
x0
3
3
1
∫ x4dx = [ (8 1 + 8 1) + 2 (1 + 1) + 4 (1 6 + 0 + 1 6 ) ]
x0
3
1 1
= [1 6 2 + 4 + 1 2 8 ] = × 2 9 4 = 9 8
3 3
3
So Approximate value of is ∫x
4
dx 98.
−3
3 5 3
x 1 1
Exact value = ∫ x 4 dx = = [243 + 243] = (486) = 97.2
−3 5 −3
5 5
Exercise
1. The velocity υ of a particle at a distance S from a point on its
path is given by the table below:
S (meter) 0 10 20 30 40 50 60
υ (m / sec) 47 58 64 65 61 52 38
Estimate the time taken to travel 60 meters by Simpson’s
rd th
1/3 rule and Simpson’s 3/8 rule.
2. Find approximately using Simpson’s 3/8th rule on
Integration.
3. Estimate the error in Trapezoidal rule, Simpson’s one-third rule
and Simpson’s three-eight rule.
76 A Text Book of Numerical Technique
Exercise
2
dx
4. Find the value of ∫ by Simpson’s rule and hence evaluate
1
x
the value of loge 2.
4
5. Compute ∫ e x dx by Simpson’s 1/3 rule with 10 subdivisons.
0
1
dx
6. Evaluate ∫ 1+ x by using I) Trapezoidal Rule II)Simpson’s
0
1/3 rule III) Simpson’s 3/8 Rule.
1
dx
7. Evaluate ∫ 1+ x 2
by using Simpson’s 3/8 rule taking h=1/6.
0
Hence evaluate the value of π.
1
8. Evaluate ∫ 1 + x3 dx by using I) Trapezoidal Rule
0
II) Simpson’s 1/3 rule.
2
dx
9. Find the value of ∫ by Simpson’s rule and Trapezoidal
1
x
Rule take h = 0.25 in the given range?
10. The table below shows the temperature f(t) as a function of
time t
t 1 2 3 4 5 6 7
F(t) 81 75 80 83 78 70 60
7
Use Simpson’s 1/3 rule method to estimate ∫ f (t ) dt .
0