Page 1
Numerical Integration
The numerical integration can be stated as follows:
Given a set of (n + 1) data points (x
i
, y
i
), i = 0, 1, 2, 3, …, n
of the function y = f (x), where f (x) is not known explicitly,
it is required to find fx dx
x
x
n
()
0
?
.
Numerical integration is also known as Numerical
quadrature.
NOTE
Newton–Cote’s Quadrature Formula
[General Quadrature formula]
Consider the integral I = fx dx
a
b
()
?
Let the interval [a, b] be divided into ‘n’ equal subintervals
of width h so that a = x
0
, x
1
= x
0
+ h, x
2
= x
0
+ 2h…b = x
0
+ nh
\ I = fx dx
x
xnh
()
0
0
+
?
Put x = x
0
+ mh ? dx = h · dm as x ? x
0
, m ? 0 and x ? x
0
+ nh, m ? n
I = h fx mh dm
n
()
0
0
+
?
Applying Newton’ s forward interpolation formula
Ih ym y
mm
ydm
n
=+ +
-
+
?
(
()
!
)
00
2
0
0
1
2
??
Integrating term by term and applying the limits, we get
fx dx
x
xnh
()
0
0
+
?
= nh y
n
y
nn
y
nn
y
00
2
0
2
3
0
2
23
12
2
24
++
-
+
-
+
?
?
?
?
?
?
?? ?
() ()
y y y
nn
y
00
2
0
2
3
0
2 12
2
24
++ +
-
+
?
?
?
?
?
?? ?
) ( )
(Newton–Cotes quadrature
formula)
x
0
x
0
+ hx
0
+ 2hx
0
+ nh
y = f(x)
y
x
On substituting n = 1, 2, 3, … in Newton-Cote’ s quadrature
formula, we get various quadrature formulae.
Trapezoidal Rule [Two-point Quadrature]
Substituting n = 1 in the Newton–Cotes formula and taking
the curve y = f (x) through (x
0
, y
0
) and (x
1
, y
1
) as a straight
line so that differences of order higher than one becomes
zero, we get
fx dx fx dx hy y
x
x
x
xh
n
() ()
00
0
00
1
2
??
== +?
?
?
?
?
?
?
+
=+ -
?
?
?
?
?
?
=+ hy yy
h
yy
01 00 1
1
22
() []
Similarly,
fx dx fx dx hy y
h
yy
xh
x
x
x
h
() () == +?
?
?
?
?
?
?
=+ []
+
+
? ?
11 12
2
1
22
0
0
1
2
Chapter 06.indd 133 5/31/2017 10:59:48 AM
Page 2
Numerical Integration
The numerical integration can be stated as follows:
Given a set of (n + 1) data points (x
i
, y
i
), i = 0, 1, 2, 3, …, n
of the function y = f (x), where f (x) is not known explicitly,
it is required to find fx dx
x
x
n
()
0
?
.
Numerical integration is also known as Numerical
quadrature.
NOTE
Newton–Cote’s Quadrature Formula
[General Quadrature formula]
Consider the integral I = fx dx
a
b
()
?
Let the interval [a, b] be divided into ‘n’ equal subintervals
of width h so that a = x
0
, x
1
= x
0
+ h, x
2
= x
0
+ 2h…b = x
0
+ nh
\ I = fx dx
x
xnh
()
0
0
+
?
Put x = x
0
+ mh ? dx = h · dm as x ? x
0
, m ? 0 and x ? x
0
+ nh, m ? n
I = h fx mh dm
n
()
0
0
+
?
Applying Newton’ s forward interpolation formula
Ih ym y
mm
ydm
n
=+ +
-
+
?
(
()
!
)
00
2
0
0
1
2
??
Integrating term by term and applying the limits, we get
fx dx
x
xnh
()
0
0
+
?
= nh y
n
y
nn
y
nn
y
00
2
0
2
3
0
2
23
12
2
24
++
-
+
-
+
?
?
?
?
?
?
?? ?
() ()
y y y
nn
y
00
2
0
2
3
0
2 12
2
24
++ +
-
+
?
?
?
?
?
?? ?
) ( )
(Newton–Cotes quadrature
formula)
x
0
x
0
+ hx
0
+ 2hx
0
+ nh
y = f(x)
y
x
On substituting n = 1, 2, 3, … in Newton-Cote’ s quadrature
formula, we get various quadrature formulae.
Trapezoidal Rule [Two-point Quadrature]
Substituting n = 1 in the Newton–Cotes formula and taking
the curve y = f (x) through (x
0
, y
0
) and (x
1
, y
1
) as a straight
line so that differences of order higher than one becomes
zero, we get
fx dx fx dx hy y
x
x
x
xh
n
() ()
00
0
00
1
2
??
== +?
?
?
?
?
?
?
+
=+ -
?
?
?
?
?
?
=+ hy yy
h
yy
01 00 1
1
22
() []
Similarly,
fx dx fx dx hy y
h
yy
xh
x
x
x
h
() () == +?
?
?
?
?
?
?
=+ []
+
+
? ?
11 12
2
1
22
0
0
1
2
Chapter 06.indd 133 5/31/2017 10:59:48 AM
fx dx fx dx
h
yy
xh
xh
x
x
() () () == +
+
+
? ?
2
23
2
3
0
0
2
3
Proceeding, fx dx
h
yy
nn
xn h
xnh
() ()
()
()
=+
-
+-
+
?
2
1
1
0
0
Hence, fx dx
h
yy yy y
x
x
nn
n
() () (
)
0
2
2
01 21
?
=+ ++ ++ ?
?
?
?
-
Thus, fx dx
h
x
x
n
()
()
(
0
2 2
?
=
+
sumofthe firstand last ordinates
sumofremain ning ordinates)
?
?
?
?
?
?
The above rule is known as Trapezoidal rule.
Geometrical Interpretation of Trapezoidal Rule
x
0
x
1
x
2
y
2
(x
2
, y
2
)
(x
n
, y
n
)
(x
n-1
, y
n-1
)
(x
1
, y
1
)
(x
0
, y
0
)
y
1
y
0
x
n
y
n
x
n-1
y
n-1
x
y
O
Geometrically, the curve y = f (x) is replaced by n straight
line segments joining the points (x
0
, y
0
) and (x
1
, y
1
); (x
1
, y
1
)
and (x
2
, y
2
); …, (x
n-1
, y
n-1
) and (x
n
, y
n
). The area bounded by
the curve y = f (x) is then approximately equal to the sum of
the areas of n trapeziums as shown in the figure.
Simpson’s One-third Rule
[Three-point Quadrature]
Substituting n = 2 in the Newton–Cotes quadrature formula
taking the curve through (x
0
, y
0
), (x
1
, y
1
) and (x
2
, y
2
) as a
parabola, so that the differences of order higher than 2
becomes zero, we get
fx dx hy yy
x
xh
() =+?+ ?
?
?
?
?
?
?
+
?
2
1
6
00
2
0
2
0
0
=+ +
h
yy y
3
4
01 2
()
Similarly,
fx dx
h
yy y
xh
xh
() () =+ +
+
+
?
3
4
23 4
2
4
0
0
fx dx
h
yy y
nn n
xn h
xnh
() ()
()
=+ +
--
+-
+
?
3
4
21
2
0
0
Therefore adding all these we get when ‘n’ is even,
fx dx
h yy yy y
yy y
x
xnh
nn
n
()
() ()
()
0
0
3
4
2
01 31
24 2
+
-
-
?
=
++ ++ +
++ ++
?
?
? ?
?
?
?
=
h
3
[(sum of the first and last ordinates
+ 4 (sum of the odd ordinates) + 2
(sum of the even ordinates)]
This is known as Simpson’ s
1
3
rule.
Simpson’s Three-eighth Rule
Substituting n = 3 in the Newton Cotes quadrature formula
and taking curve through (x
0
, y
0
), (x
1
, y
1
), (x
2
, y
2
) and (x
3
, y
3
)
so that the differences of order higher than three becomes
zero, we get
fx dx hy yy y
x
x
()
0
3
3
3
2
3
2
1
8
00
2
0
3
0
?
=+ ++
?
?
?
?
?
?
?? ?
=+ ++
3
8
33
01 23
h
yy yy ()
Similarly,
fx dx
h
yy yy
x
x
() ()
3
6
3
8
33
34 56
?
=+ ++ and so on.
Adding all these integrals from x
0
to x
n
where ‘n’ is a
multiple of 3, we get
fx dx
h
x
x
n
()
0
3
8
?
= [ (y
0
+ y
n
) + 3(y
1
+ y
2
+ y
4
+ y
5
+
…
+ y
n-2
)
+ 2(y
3
+ y
6
+ y
9
+
…
+ y
n-3
)]
The above rule is called Simpson’s
3
8
rule which is
applicable only when ‘n’ is a multiple of 3.
Example
Evaluate:
1
2
0
2
+
?
xdx taking h = 0.2 using
(i) Trapezoidal rule and
(ii) Simpson’ s
1
3
rd rule
Solution
Here, a = 0, b = 2, h = 0.2
So, n =
ba
h
-
=
- 20
02 .
= 10
Chapter 06.indd 134 5/31/2017 10:59:50 AM
Page 3
Numerical Integration
The numerical integration can be stated as follows:
Given a set of (n + 1) data points (x
i
, y
i
), i = 0, 1, 2, 3, …, n
of the function y = f (x), where f (x) is not known explicitly,
it is required to find fx dx
x
x
n
()
0
?
.
Numerical integration is also known as Numerical
quadrature.
NOTE
Newton–Cote’s Quadrature Formula
[General Quadrature formula]
Consider the integral I = fx dx
a
b
()
?
Let the interval [a, b] be divided into ‘n’ equal subintervals
of width h so that a = x
0
, x
1
= x
0
+ h, x
2
= x
0
+ 2h…b = x
0
+ nh
\ I = fx dx
x
xnh
()
0
0
+
?
Put x = x
0
+ mh ? dx = h · dm as x ? x
0
, m ? 0 and x ? x
0
+ nh, m ? n
I = h fx mh dm
n
()
0
0
+
?
Applying Newton’ s forward interpolation formula
Ih ym y
mm
ydm
n
=+ +
-
+
?
(
()
!
)
00
2
0
0
1
2
??
Integrating term by term and applying the limits, we get
fx dx
x
xnh
()
0
0
+
?
= nh y
n
y
nn
y
nn
y
00
2
0
2
3
0
2
23
12
2
24
++
-
+
-
+
?
?
?
?
?
?
?? ?
() ()
y y y
nn
y
00
2
0
2
3
0
2 12
2
24
++ +
-
+
?
?
?
?
?
?? ?
) ( )
(Newton–Cotes quadrature
formula)
x
0
x
0
+ hx
0
+ 2hx
0
+ nh
y = f(x)
y
x
On substituting n = 1, 2, 3, … in Newton-Cote’ s quadrature
formula, we get various quadrature formulae.
Trapezoidal Rule [Two-point Quadrature]
Substituting n = 1 in the Newton–Cotes formula and taking
the curve y = f (x) through (x
0
, y
0
) and (x
1
, y
1
) as a straight
line so that differences of order higher than one becomes
zero, we get
fx dx fx dx hy y
x
x
x
xh
n
() ()
00
0
00
1
2
??
== +?
?
?
?
?
?
?
+
=+ -
?
?
?
?
?
?
=+ hy yy
h
yy
01 00 1
1
22
() []
Similarly,
fx dx fx dx hy y
h
yy
xh
x
x
x
h
() () == +?
?
?
?
?
?
?
=+ []
+
+
? ?
11 12
2
1
22
0
0
1
2
Chapter 06.indd 133 5/31/2017 10:59:48 AM
fx dx fx dx
h
yy
xh
xh
x
x
() () () == +
+
+
? ?
2
23
2
3
0
0
2
3
Proceeding, fx dx
h
yy
nn
xn h
xnh
() ()
()
()
=+
-
+-
+
?
2
1
1
0
0
Hence, fx dx
h
yy yy y
x
x
nn
n
() () (
)
0
2
2
01 21
?
=+ ++ ++ ?
?
?
?
-
Thus, fx dx
h
x
x
n
()
()
(
0
2 2
?
=
+
sumofthe firstand last ordinates
sumofremain ning ordinates)
?
?
?
?
?
?
The above rule is known as Trapezoidal rule.
Geometrical Interpretation of Trapezoidal Rule
x
0
x
1
x
2
y
2
(x
2
, y
2
)
(x
n
, y
n
)
(x
n-1
, y
n-1
)
(x
1
, y
1
)
(x
0
, y
0
)
y
1
y
0
x
n
y
n
x
n-1
y
n-1
x
y
O
Geometrically, the curve y = f (x) is replaced by n straight
line segments joining the points (x
0
, y
0
) and (x
1
, y
1
); (x
1
, y
1
)
and (x
2
, y
2
); …, (x
n-1
, y
n-1
) and (x
n
, y
n
). The area bounded by
the curve y = f (x) is then approximately equal to the sum of
the areas of n trapeziums as shown in the figure.
Simpson’s One-third Rule
[Three-point Quadrature]
Substituting n = 2 in the Newton–Cotes quadrature formula
taking the curve through (x
0
, y
0
), (x
1
, y
1
) and (x
2
, y
2
) as a
parabola, so that the differences of order higher than 2
becomes zero, we get
fx dx hy yy
x
xh
() =+?+ ?
?
?
?
?
?
?
+
?
2
1
6
00
2
0
2
0
0
=+ +
h
yy y
3
4
01 2
()
Similarly,
fx dx
h
yy y
xh
xh
() () =+ +
+
+
?
3
4
23 4
2
4
0
0
fx dx
h
yy y
nn n
xn h
xnh
() ()
()
=+ +
--
+-
+
?
3
4
21
2
0
0
Therefore adding all these we get when ‘n’ is even,
fx dx
h yy yy y
yy y
x
xnh
nn
n
()
() ()
()
0
0
3
4
2
01 31
24 2
+
-
-
?
=
++ ++ +
++ ++
?
?
? ?
?
?
?
=
h
3
[(sum of the first and last ordinates
+ 4 (sum of the odd ordinates) + 2
(sum of the even ordinates)]
This is known as Simpson’ s
1
3
rule.
Simpson’s Three-eighth Rule
Substituting n = 3 in the Newton Cotes quadrature formula
and taking curve through (x
0
, y
0
), (x
1
, y
1
), (x
2
, y
2
) and (x
3
, y
3
)
so that the differences of order higher than three becomes
zero, we get
fx dx hy yy y
x
x
()
0
3
3
3
2
3
2
1
8
00
2
0
3
0
?
=+ ++
?
?
?
?
?
?
?? ?
=+ ++
3
8
33
01 23
h
yy yy ()
Similarly,
fx dx
h
yy yy
x
x
() ()
3
6
3
8
33
34 56
?
=+ ++ and so on.
Adding all these integrals from x
0
to x
n
where ‘n’ is a
multiple of 3, we get
fx dx
h
x
x
n
()
0
3
8
?
= [ (y
0
+ y
n
) + 3(y
1
+ y
2
+ y
4
+ y
5
+
…
+ y
n-2
)
+ 2(y
3
+ y
6
+ y
9
+
…
+ y
n-3
)]
The above rule is called Simpson’s
3
8
rule which is
applicable only when ‘n’ is a multiple of 3.
Example
Evaluate:
1
2
0
2
+
?
xdx taking h = 0.2 using
(i) Trapezoidal rule and
(ii) Simpson’ s
1
3
rd rule
Solution
Here, a = 0, b = 2, h = 0.2
So, n =
ba
h
-
=
- 20
02 .
= 10
Chapter 06.indd 134 5/31/2017 10:59:50 AM
The values of x and y are tabulated as follows:
x 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
y = +
2
1 x
1
y
0
1.0198
y
1
1.077
y
2
1.1661
y
3
1.2806
y
4
1.414
y
5
1.562
y
6
1.7204
y
7
1.8867
y
8
2.059
y
9
2.236
y
10
By Simpon’ s three-eighth rule,
edx
h
x cos
0
2
3
8
p/
?
= [(y
0
+ y
3
) + 3(y
1
+ y
2
)]
=
3
86
×
p
[(2.718 + 1) + 3(2.3774 + 1.6487)]
=
p
16
·[(3.718) + (12.0783)] = 3.10159.
(i) By Trapezoidal rule,
1
2
2
2
0
2
0101 29
+= ++ ++ + []
?
xdx
h
yy yy y () ()
=
02
2
.
[(1 + 2.236) + 2(1.0198 + 1.077 + 1.1661 +
1.2806 + 1.414 + 1.562 + 1.7204 + 1.8867 + 2.059)]
= 0.1 [(3.236) + 2(13.1856)]
= 0.1 [29.6072] = 2.96072.
(ii) By Simpson’ s
1
3
rule,
1
2
0
2
+
?
xdx
=
++ ++ ++
++ ++
?
?
?
?
?
?
h yy yy yy y
yy yy 3
4
2
0101 35 79
24 68
() ()
()
=
02
3
.
[(1 + 2.236) + 4(1.0198 + 1.1661 + 1.414
+ 1.7204 + 2.059) + 2(1.077 + 1.2806 + 1.562 +
1.8867)]
=
02
3
.
[(3.236) + 29.5172 + 11.6126]
= 2.95772.
Example
Evaluate edx
x cos
0
2 p /
?
· by Simpson’ s three-eighth rule.
Solution
Taking h =
p
6
· , the range can be divided into three equal, sub
intervals with the division points. The values of x and y are
tabulated as below.
x 0
p
6 3
p
2
p
y = e
cos
x
2.718( y
0
) 2.3774( y
1
) 1.6487( y
2
) 1( y
3
)
Chapter 06.indd 135 5/31/2017 10:59:53 AM
Read More