Unit3 - Numerical Integration PDF
Unit3 - Numerical Integration PDF
Unit3 - Numerical Integration PDF
K OLHAPUR
S.Y. B. T ECH .
C OMPUTER S CIENCE AND E NGINEERING
Prepared by
Contents
1 Numerical Integration 2
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Newton Cote’s Quadrature Formula . . . . . . . . . . . . . . 2
1.3 Trapezoidal Rule(n=1) . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Simpsons One-Third Rule (n=2) . . . . . . . . . . . . . . . . . 3
1.5 Simpson Three-Eighth Rule (n=3) . . . . . . . . . . . . . . . . 4
1.6 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Weddle’s Rule (n=6) . . . . . . . . . . . . . . . . . . . . . . . 13
1.8 Romberg’s Integration . . . . . . . . . . . . . . . . . . . . . . 14
1.9 M.C.Q. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
CONTENTS 1
Mr. S.S. Salgare
1 Numerical Integration
1.1 Introduction
Given a set of tabulated values of the integrand f ( x ), to determine the value
of integral Z xn
f ( x ) dx
xo
i) Trapezoidal rule
v) Romberg’s formula
1 NUMERICAL INTEGRATION 2
Mr. S.S. Salgare
1 NUMERICAL INTEGRATION 3
Mr. S.S. Salgare
Continue . . .
Z x0 +nh
h
f ( x ) dx = (yn−2 + 4yn−1 + yn )
x0 +(n−2)h 3
Z x0 +nh
h
f ( x ) dx = [(y0 + yn ) + 4(y1 + y3 + · · · + yn−1 ) + 2(y2 + y4 + · · · + yn−2 )]
x0 3
Remark: While using this formula, the given interval of integration must
be divided into sub-intervals whose number n is multiple of 3.
1 NUMERICAL INTEGRATION 4
Mr. S.S. Salgare
1.6 Examples
Z 1
Example 1 Use Trapezoidal rule to evaluate x3 dx considering five sub-intervals.
0
Solution: Dividing the interval (0, 1) into 5 equal parts, each of width
1−0
h= = 0.2, the value of f ( x ) = x3 are given below:
5
x 0 0.2 0.4 0.6 0.8 1
f (x) 0 0.008 0.064 0.216 0.512 1
y0 y1 y2 y3 y4 y5
By Trapezoidal rule
Z 1
h
x3 dx = [(y0 + y5 ) + 2(y1 + y2 + y3 + y4 )]
0 2
02
= [(0 + 1) + 2(0.008 + 0.064 + 0.216 + 0.512)]
2
= 0.26
Z 1
x3 dx = 0.26
0
Z 1
dx
Example 2 evaluate using
0 1 + x2
1 rd 1
i) Simpsons rule taking h =
3 4
3 th 1
ii) Simpsons rule taking h =
8 6
Hence compute an approximate value of π in each case.
Solution:
1
i) the value of f ( x ) = at x = 0, 1/4, 2/4, 3/4, 1 are given below:
1 + x2
1 NUMERICAL INTEGRATION 5
Mr. S.S. Salgare
Z 1
dx h
−1
i1 π
Also 2
= tan x =
0 1+x 0 4
Hence
π
= 0.7854 ⇒ π = 3.1416 approximately
4
1
ii) The value of f ( x ) = at x = 0, 1/6, 2/6, 3/6, 4/6, 5/6, 1 are given
1 + x2
below:
Solution: Divide the interval (0, 6) into six parts of width h = 1. The value
1
of f ( x ) = are given below:
1 + x2
x 0 1 2 3 4 5 6
f (x) 1 0.5 0.2 0.1 0.0588 0.0385 0.0270
y0 y1 y2 y3 y4 y5 y6
1 NUMERICAL INTEGRATION 6
Mr. S.S. Salgare
Example 4 The speed, v meters per second of a car t seconds after it starts, is
shown in the following table:
t 0 12 24 36 48 60 72 84 96 108 120
v 0 3.60 10.08 18.90 21.60 18.54 10.26 5.40 4.50 5.40 9.00
v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10
Using Simpson’s rule, find the distance traveled by the car in 2 minutes.
1 NUMERICAL INTEGRATION 7
Mr. S.S. Salgare
Example 6 Find from the following table, the area bounded by the curve and the
X-axis from x=7.47 to x=7.52
x 7.47 7.48 7.49 7.50 7.51 7.52
f (x) 1.93 1.95 1.98 2.01 2.03 2.06
Solution: we know that
Z 7.52
Area = f ( x ) dx
7.47
Z 0.3
Example 7 Use Simpson’s rule for evaluating f ( x0 dx from the following
−0.6
table given below
x -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3
f (x) 4 2 5 3 -2 1 6 4 2 8
Solution: Since the number of sub intervals is 9 (a multiple of 3) hence we
will use Simpson’s three-eighth rule
Z 0.3
3(0.1)
f ( x0 dx = [(4 + 8) + 3(2 + 5 − 2 + 1 + 4 + 2) + 2(3 + 6)] = 2.475
−0.6 8
1 NUMERICAL INTEGRATION 8
Mr. S.S. Salgare
Z 2
Example 8 Evaluate e−1/2x dx using four intervals
1
Since we have four (even) sub intervals here, we will use Simpson’s one-
third rule
Z 2
h
e−1/2x dx = [(y0 + y4 ) + 4(y1 + y3 ) + 2y2 ]
1 3
0.25
= [(0.60653 + 0.36788) + 4(0.53526 + 0.41686) + 2(0.47237)]
3
= 0.4773025
ex
Z 6
Example 9 Find dx approximately suing Simpson’s three-eighth rule
0 1+x
on integration.
Solution: Divide the given integral of integration into 6 equal sub intervals,
the arguments are 0,,1, 2, 3, 4, 5, 6: h = 1. The table is as below
x 0 1 2 3 4 5 6
y 1 1.3591 2.4630 5.0214 10.9196 24.7355 57.6327
ex
Z 6
3h
dx = [(y0 + y6 ) + 3(y1 + y2 + y4 + y5 ) + 2y3 ] = 70.1652
0 1+x 8
ex
Z 6
Note: It is not possible to evaluate dx by using usual calculus
0 1+x
method. Numerical integration comes to our rescue in such situation.
Example 10 A train is moving at the speed of 30m/sec. Suddenly brakes are ap-
plied. The speed of the train per second after t second is given by
Time (t) 0 5 10 15 20 25 30 35 40 45
Speed (v) 30 24 19 16 13 11 10 8 7 5
Apply Simpson ’s three-eighth rule to determine the distance moved by the train
in 45 seconds.
1 NUMERICAL INTEGRATION 9
Mr. S.S. Salgare
x 0 10 20 30 40 50 60 70 80
y 0 4 7 9 12 15 14 8 3
Find the approximate area of cross-section of the river using Simpson’s one-third
rule.
Solution: The required area of the cross section of the river is given by
Z 80
Area = y dx
0
Hence the required area of the cross section of the river is 710 sq. m.
1 NUMERICAL INTEGRATION 10
Mr. S.S. Salgare
1 NUMERICAL INTEGRATION 11
Mr. S.S. Salgare
dy1 1
Solution: The given curve is y = =− 2→
dxx x
s s
r
1 + x4
ds dy 1
= 1+ = 1+ 4 =
dx dx x x4
The arc length of the curve between the points (1, 1) and (5, 51 ) is
s
1 + x4
Z 5
h
Arc length = = [(1.414 + 1.001) + 4(1.031 + 1.002) + 2(1.007)] = 4.187
1 x4 3
h (in meters) 10 11 12 13 14
A (in sq. meters) 950 1070 1200 1350 1530
dh 48 √
=− h
dt A
Estimate the time taken for the water level to fall 14 to 10 m above the sluices.
Solution: From
dh 48 √ A dh
=− h ⇒ dt = − √
dt A 48 h
Z 10
1 A
⇒ t=− √ dh
48 14 h
1
Z 14 A
⇒ t= √ dh
48 10 h
A
Here, y = √ . table of values is as below
h
h 10 11 12 13 14
A
√ 300.4164 322.6171 346.4102 374.4226 408.9097
h
Applying Simpson’s one-third rule, we get
1 1
t= ∗ [(300.4164 + 408.9097) + 4(322.6171 + 374.4226) + 2(346.4102)]
48 3
= 29.0993minutes
1 NUMERICAL INTEGRATION 12
Mr. S.S. Salgare
3h
I = [y0 + 5y1 + y2 + 6y3 + y4 + 5y5 + y6 ]
10
3 × 1/6
= [1 + 5 × 0.9730 + 0.9 + 6 × 0.8 + 0.6923 + 5 × 0.5902 + 0.5]
10
= 0.7854
I = 0.7854
Z 1.4
Example 17 Evaluate (sin x − loge x + e x ) dx approximately using Wed-
0.2
dles’s rule correct to 4 decimal.
Z 1.4
Solution: Let I = (sin x − loge x + e x ) dx
0.2
Here f ( x ) = sin x − loge + e x
x n − x0 1.4 − 0.2
Let n = 12, then h = = = 0.1
n 12
x 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4
y 3.029 2.849 2.797 2.821 2.898 3.015 3.167 3.348 3.551 3.8 4.067 4.37 4.704
y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12
By Weddles rule
3h
I = [y0 + 5y1 + y2 + 6y3 + y4 + 5y5 + y6 + y6 + 5y7 + y8 + 6y9 + y10 + 5y11 + y12 ]
10
= 1.8279
1 NUMERICAL INTEGRATION 13
Mr. S.S. Salgare
Solution: 591.855
Ans: 1.0102
1 NUMERICAL INTEGRATION 14
Mr. S.S. Salgare
and so on.
Also
h h 1 h h h
I h, , = 4I , − I h,
2 4 3 2 4 2
h h h 1 h h h h
I , , = 4I , −I ,
2 4 8 3 4 8 2 4
and so on.
Z 1
dx
Example 20 Evaluate correct to three decimal places using Romberg’s
0 1+x
method.
Solution: Taking h = 0.5, 0.25 and 0.125 successively. Let us evaluate the
given integral by Trapezoidal rule.
1
i) When h = 0.5, the value of y = are
1+x
x 0 0.5 1
y 1 0.667 0.5
y0 y1 y2
By Trapezoidal rule
h
I = [(y0 + y2 ) + 2y1 ]
2
0.5
= [(1 + 0.5) + 2 × 0.667]
2
= 0.709
I (h) = 0.709
1
ii) When h = 0.25, the value of y = are
1+x
By Trapezoidal rule
h
I = [(y0 + y4 ) + 2(y1 + y2 + y3 )]
2
0.5
= [(1 + 0.5) + 2 × (0.8 + 0.667 + 0.571)]
2
= 0.697
1 NUMERICAL INTEGRATION 15
Mr. S.S. Salgare
h
I = 0.697
2
1
iii) When h = 0.125, the value of y = are
1+x
By Trapezoidal rule
h
I = [(y0 + y8 ) + 2(y1 + y2 + y3 + y4 + y5 + y6 + y7 )]
2
0.5
= [(1 + 0.5) + 2 × (0.889 + 0.8 + 0.727 + 0.667 + 0.615 + 0.571 + 0.5333)]
2
= 0.694
h
I = 0.694
4
Solution: Taking h = 0.5, 0.25 and 0.125 successively. Let us evaluate the
given integral by Trapezoidal rule.
1
i) When h = 0.5, the value of y = are
1+x
x 0 0.5 1
y 1 0. 0.5
y0 y1 y2
1 NUMERICAL INTEGRATION 16
Mr. S.S. Salgare
By Trapezoidal rule
h
I = [(y0 + y2 ) + 2y1 ]
2
0.5
= [(1 + 0.5) + 2 × 0.8]
2
= 0.0.775
I (h) = 0.775
1
ii) When h = 0.25, the value of y = are
1+x
By Trapezoidal rule
h
I = [(y0 + y4 ) + 2(y1 + y2 + y3 )]
2
0.5
= [(1 + 0.5) + 2 × (0.9412 + 0.8 + 0.64)]
2
= 0.7828
h
I = 0.7828
2
1
iii) When h = 0.125, the value of y = are
1+x
By Trapezoidal rule
h
I = [(y0 + y8 ) + 2(y1 + y2 + y3 + y4 + y5 + y6 + y7 )]
2
0.5
= [(1 + 0.5) + 2(0.9846 + 0.9412 + 0.8767 + 0.8 + 0.7191 + 0.64 + 0.5664)]
2
= 0.7848
h
I = 0.7848
4
1 NUMERICAL INTEGRATION 17
Mr. S.S. Salgare
1.9 M.C.Q.
Q.) Choose the correct answer
1 rd
1) Simpsons rule of integration is exact for all polynomials of degree
3
not exceeding . . . .
A) 1 B) 2 C) 3 D) 4
3 th
2) Simpsons rule is applicable only when. . . .
8
A) n is a multiple of 3 C) n is a multiple of 8
B) n is a multiple of 6 D) n is a multiple of 24
1 rd
3) In Simpsons rule the number of intervals must be . . . .
3
A) a multiple of 3 C) odd
B) a multiple of 6 D) even
1 NUMERICAL INTEGRATION 18
Mr. S.S. Salgare
A) 1 B) 2 C) 3 D) 4
1 rd
6) The degree of y( x ) in Simpsons rule is . . . .
3
A) 1 B) 2 C) 3 D) 4
3 th
7) The degree of y( x ) in Simpsons is . . . .
8
A) 1 B) 2 C) 3 D) 4
1 rd
10) Simpsons rule will give exact result if the entire curve y = f ( x ) is
3
itself a . . . .
A) even C) 1,2,3,4,5,6.......
B) odd D) large as possible
1 NUMERICAL INTEGRATION 19
Mr. S.S. Salgare
A) 1 B) 2 C) 3 D) 0
17) To apply Simpsons one third rule, the given interval must be divided
into an . . . number of equal intervals.
1 NUMERICAL INTEGRATION 20
Mr. S.S. Salgare
Assignment No.3
Z 1.2
(1) Evaluate the integral e x dx, taking six intervals by using trape-
0
zoidal rule up to three decimal places.
Z 6
(2) Evaluate log10 x dx by using trapezoidal rule, taking n = 8 correct
2
to four decimal places.
Z π/2 √
(3) Evaluate cos x dx by Simpson’s 1/3 rule taking n = 6
0
Z 5.2
(4) Evaluate log x dx by taking seven grid points and using the Simp-
4
son’s 1/3 rule.
Z 1√
(5) Evaluate sin x + cos x dx correct to two decimal places using Simp-
0
son’s 3/8 rule.
Z 6
1
(6) Evaluate dx by using Simpson’s 3/8 rule.
2 log e x
R 1 x2 + 2
(7) Evaluate 0 x2 + 1
dx by Weddle’s rule correct to four decimal places.
Z 1/2
1
(8) Find by Weddle’s rule the value of the integral √ dx
0 x2 + 1
Z 2 2
1
(9) Use Romberg’s method to evaluate x+ dx, take h = 0.5, 0.25&0.125
1 x
Z 2
1
(10) Use Romberg’s method to evaluate
dx
x 1
———————————————————
1 NUMERICAL INTEGRATION 21
Mr. S.S. Salgare
2. 2.3267
3.
4.
5.
6.
7. 1.7854
8. 0.5236
9. 0.8332
10. 0.6931
*****************************
1 NUMERICAL INTEGRATION 22