Numerical Integration
Lecture Notes
Mohammad Sabawi
Department of Mathematics
College of Education for Women
Tikrit University
Email: mohammad.sabawi@tu.edu.iq
01 October 2021
Contents
1 Numerical Integration 3
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Newton-Cotes Formulas of Integration . . . . . . . . . . . . . . . . 3
1.2.1 Closed Newton-Cotes Integration Rules . . . . . . . . . . . 3
1.2.2 Open Newton-Cotes Integration Rules . . . . . . . . . . . . 7
2
Chapter 1
Numerical Integration
1.1 Introduction
In solving daily life problems, we sometimes encountered with integrations
problems whose integrals cannot be computed analytically. In these scenarios
we resort to numerical integration to integrate these problems numerically by
using approximating methods. In these lecture notes, we focus on Newton-
Cotes formulas of integration.
1.2 Newton-Cotes Formulas of Integration
Newton-Cotes quadrature Rformulas are numerical formulas used to approxi-
b
mate the definite integral a f (x) dx. In these formulas the function of inte-
gration or the integrand is replaced by an interpolating polynomial. These
integration rules are said to be closed if they include the function values at
the end of the integration interval. Otherwise, they are called open.
1.2.1 Closed Newton-Cotes Integration Rules
The general structure of these formulas is as follows: Let a = x0 , b = xn and
the step size h = b−a
n
, then the internal integration points can be defined by
xi = x0 + ih, i = 1, · · · , n, where fi = f (xi ), i = 0, · · · , n. Here, we consider
some of these closed rules such as:
(a) Trapezoid Rule:
Z x1
1
f (x) dx = h[f0 + f1 ].
x0 2
3
CHAPTER 1. NUMERICAL INTEGRATION
1
(b) Simpson’s 3
Rule:
Z x2
1
f (x) dx = h[f0 + 4f1 + f2 ].
x0 3
3
(c) Simpson’s 8
Rule:
Z x3
3
f (x) dx = h[f0 + 3f1 + 3f2 + f3 ].
x0 8
(d) Boole’s Rule:
Z x4
2
f (x) dx = h[7f0 + 32f1 + 12f2 + 32f3 + 7f4 ].
x0 45
(e) Six-Point Newton-Cotes Closed Rule:
Z x5
5
f (x) dx = h[19f0 + 75f1 + 50f2 + 50f3 + 75f4 + 19f5 ].
x0 288
2
Example 1. Consider the function f (x) =R ex , use the above-mentioned
0.6 2
quadrature rules to approximate the integral 0 ex dx.
Solution: Let us divide the interval of integration I = [a, b] = [0, 0.6] to six
equal subintervals (i.e. n = 6). Hence, h = (b − a)/n = (0.6 − 0)/6 = 0.1.
The function values at the end points are:
2 2
f0 = f (x0 ) = ex0 = e(0) = 1,
and
2 2
f6 = f (x6 ) = ex6 = e(0.6) = 1.43332941.
Now, we compute the points of integration xi = x0 + ih, i = 1, · · · , 6.
So, when i = 1
2 2
x1 = x0 + h = 0 + 0.1 = 0.1, f1 = f (x1 ) = ex1 = e(0.1) = 1.01005017,
when i = 2
2 2
x2 = x0 + 2h = 0 + 2(0.1) = 0.2, f2 = f (x2 ) = ex2 = e(0.2) = 1.04081078,
when i = 3
2 2
x3 = x0 + 3h = 0 + 3(0.1) = 0.3, f3 = f (x3 ) = ex3 = e(0.3) = 1.09417428,
4 Mohammad Sabawi/Numerical Analysis
CHAPTER 1. NUMERICAL INTEGRATION
when i = 4
2 2
x4 = x0 + 4h = 0 + 4(0.1) = 0.4, f4 = f (x4 ) = ex4 = e(0.4) = 1.17351087,
when i = 4
2 2
x5 = x0 + 5h = 0 + 5(0.1) = 0.5, f5 = f (x5 ) = ex5 = e(0.5) = 1.28402542,
The computations are summarised in the table below:
x f (x)
0 1
0.1 1.01005017
0.2 1.04081078
0.3 1.09417428
0.4 1.17351087
0.5 1.28402542
0.6 1.43332941
(a) Trapezoid Rule: The interval of integration is I = [a, b] = [0, 0.6], so,
n = 1. Hence, h = (b − a)/n = (0.6 − 0)/1 = 0.6. The function values at
the end points x0 = 0 and x1 = 0.6 are:
2 2
f0 = f (x0 ) = ex0 = e(0) = 1,
and
2 2
f1 = f (x1 ) = ex6 = e(0.6) = 1.43332941.
Consequently, we get
Z x1 Z 0.6
2 1 1
f (x) dx = ex dx = h[f0 +f1 ] = (0.6)[1+1.43332941] = 0.72999882.
x0 0 2 2
(b) Simpson’s 13 Rule: We divide the integration interval I = [a, b] =
[0, 0.6] to two equal subintervals (i.e. n = 2). Hence, h = (b − a)/n =
(0.6 − 0)/2 = 0.3. The integration nodes are x0 = 0, x1 = x0 + h =
0 + (1)(0.3) = 0.3, and x2 = 0.6. The functional values at the integration
nodes are:
2 2
f0 = 1, f1 = f (x1 ) = ex1 = e(0.3) = 1.09417428, f2 = 1.43332941.
Z x2 Z 0.6
2 1 1
f (x) dx = ex dx = h[f0 + 4f1 + f2 ] = (0.3)[1 + 4(1.09417428)
x0 0 3 3
+1.43332941] = 0.68100265.
5 Mohammad Sabawi/Numerical Analysis
CHAPTER 1. NUMERICAL INTEGRATION
(c) Simpson’s 38 Rule: In this rule, we divide the integration interval I =
[0, 0.6] to three equal subintervals (i.e. n = 3). Hence, h = (b − a)/n =
(0.6 − 0)/3 = 0.2. The integration nodes are x0 = 0, x1 = x0 + (1)h =
0 + (1)(0.2) = 0.2, x2 = x0 + 2h = 0 + 2(0.2) = 0.4 and x3 = 0.6. The
functional values at the integration nodes are:
f0 = 1, f1 = 1.04081078, f2 = 1.17351087, f3 = 1.43332941.
Z x3 Z 0.6
2 3 3
f (x) dx = ex dx = h[f0 + 3f1 + 3f2 + f3 ] = (0.2)[1 + 3(1.04081078)
x0 0 8 8
+3(1.17351087) + 1.43332941] = 0.68072208.
(d) Boole’s Rule: In Boole’s rule, we divide the integration interval I =
[0, 0.6] to four equal subintervals, n = 4. So, h = (b−a)/n = (0.6−0)/4 =
0.15. The integration nodes are x0 = 0, x1 = x0 + (1)h = 0 + (1)(0.15) =
0.15, x2 = x0 + 2h = 0 + 2(0.15) = 0.3, x3 = x0 + 3h = 0 + 3(0.15) = 0.45
and x4 = 0.6. The functional values at the integration nodes are:
f0 = 1, f1 = 1.02275503, f2 = 1.09417428, f3 = 1.22446006, f4 = 1.43332941.
Z x4 Z 0.6
2 2
f (x) dx = ex dx = h[7f0 + 32f1 + 12f2 + 32f3 + 7f4 ]
x0 0 45
2
= (0.15)[7(1) + 32(1.02275503) + 12(1.09417428)
45
+32(1.22446006) + 7(1.43332941)] = 0.68049520.
(e) Six-Point Newton-Cotes Closed Rule: We divide the integration
interval I = [0, 0.6] to five equal subintervals, n = 5. So, h = (b −
a)/n = (0.6 − 0)/5 = 0.12. The integration nodes are x0 = 0, x1 =
x0 + (1)h = 0 + (1)(0.12) = 0.12, x2 = x0 + 2h = 0 + 2(0.12) = 0.24,
x3 = x0 + 3h = 0 + 3(0.12) = 0.36, x4 = x0 + 4h = 0 + 4(0.12) = 0.48
and x5 = 0.6. The functional values at the integration nodes are:
f0 = 1, f1 = 1.01450418, f2 = 1.05929119, f3 = 1.13837294, f4 = 1.25910355,
f5 = 1.43332941.
Z x5 Z 0.6
2 5
f (x) dx = ex dx = h[19f0 + 75f1 + 50f2 + 50f3 + 75f4 + 19f5 ]
x0 0 288
5
=
(0.12)[19(1) + 75(1.01450418) + 50(1.05929119)
288
+50(1.13837294) + 75(1.25910355) + 19(1.43332941)] = 0.68049384.
6 Mohammad Sabawi/Numerical Analysis
CHAPTER 1. NUMERICAL INTEGRATION
1.2.2 Open Newton-Cotes Integration Rules
The general structure of these formulas is the same as the general structure of
the closed rules except that the two end points x0 = a, xn = b and their func-
tional values f (x0 ) = f (a), f (xn ) = f (b) are not included in the integrations
formulas. We consider the following open rules:
(a) Midpoint Rule: Z x2
f (x) dx = 2hf1 .
x0
(b) Two-Point Newton-Cotes Open Rule:
Z x3
3
f (x) dx = h[f1 + f2 ].
x0 2
(c) Three-Point Newton-Cotes Open Rule:
Z x4
4
f (x) dx = h[2f1 − f2 + 2f3 ].
x0 3
(d) Four-Point Newton-Cotes Open Rule:
Z x5
5
f (x) dx = h[11f1 + f2 + f3 + 11f4 ].
x0 24
(e) Five-Point Newton-Cotes Open Rule:
Z x6
6
f (x) dx = h[11f1 − 14f2 + 26f3 − 14f4 + 11f5 ].
x0 20
Example 2. Redo Example R1 use the above-mentioned quadrature open rules
0.6 2
to approximate the integral 0 ex dx.
(a) Midpoint Rule: We divide the integration interval I = [0, 0.6] to two
equal subintervals, n = 2. So, h = (b − a)/n = (0.6 − 0)/2 = 0.3, so,
x0 = 0, x1 = x0 + (1)h = 0 + (1)(0.3) = 0.3 and x2 = 0.6. The function
values at the integration points are:
f0 = 1, f1 = 1.09417428, f2 = 1.43332941.
Z x2 Z 0.6
2
f (x) dx = ex dx = 2hf1 = 2(0.3)(1.09417428) = 0.65650457.
x0 0
7 Mohammad Sabawi/Numerical Analysis
CHAPTER 1. NUMERICAL INTEGRATION
(b) Two-Point Newton-Cotes Open Rule: Now, we divide the interval
of integration I = [0, 0.6] to three equal subintervals, i.e. n = 3. So,
h = (b − a)/n = (0.6 − 0)/3 = 0.2, so, x0 = 0, x1 = x0 + (1)h =
0 + (1)(0.2) = 0.2, x2 = x0 + (2)h = 0 + (2)(0.2) = 0.4 and x3 = 0.6. The
functional values at the integration nodes are:
f0 = 1, f1 = 1.04081078, f2 = 1.17351087, f3 = 1.43332941.
Z x3 Z 0.6
2 3 3
f (x) dx = ex dx = h[f1 + f2 ] = (0.2)[1.04081078 + 1.17351087]
x0 0 2 2
= 0.66429650.
(c) Three-Point Newton-Cotes Open Rule: In this rule, the interval of
integration I = [0, 0.6] is divided to four equal subintervals, i.e. n = 4.
So, h = (b − a)/n = (0.6 − 0)/4 = 0.15, so, x0 = 0, x1 = x0 + (1)h =
0 + (1)(0.15) = 0.15, x2 = x0 + (2)h = 0 + (2)(0.15) = 0.3, x3 =
x0 + (3)h = 0 + (3)(0.15) = 0.45 and x4 = 0.6. The values of the function
at the integration nodes are:
f0 = 1, f1 = 1.02275503, f2 = 1.09417428, f3 = 1.22446006, f4 = 1.43332941.
Z x4 Z 0.6
2 4 4
f (x) dx = ex dx = h[2f1 − f2 + 2f3 ] = (0.15)[2(1.02275503)
x0 0 3 3
−1.09417428 + 2(1.22446006)] = 0.68005118.
(d) Four-Point Newton-Cotes Open Rule: We divide the interval of
integration I = [0, 0.6] to five equal subintervals, i.e. n = 5. So, h =
(b − a)/n = (0.6 − 0)/5 = 0.12, hence, x0 = 0, x1 = x0 + (1)h =
0 + (1)(0.12) = 0.12, x2 = x0 + (2)h = 0 + (2)(0.12) = 0.24, x3 =
x0 + (3)h = 0 + (3)(0.12) = 0.36, x4 = x0 + (4)h = 0 + (4)(0.12) = 0.48
and x5 = 0.6. The function values at the integration nodes are:
f0 = 1, f1 = 1.01450418, f2 = 1.05929119, f3 = 1.13837294, f4 = 1.25910355,
f5 = 1.43332941.
Z x5 Z 0.6
2 5 5
f (x) dx = ex dx = h[11f1 + f2 + f3 + 11f4 ] = (0.12)[11(1.01450418)
x0 0 24 24
+1.05929119 + 1.13837294 + 11(1.25910355)] = 0.68018373.
8 Mohammad Sabawi/Numerical Analysis
CHAPTER 1. NUMERICAL INTEGRATION
(e) Five-Point Newton-Cotes Open Rule: In this rule, the interval of
integration I = [0, 0.6] is divided to six equal subintervals, i.e. n = 6.
So, h = (b − a)/n = (0.6 − 0)/6 = 0.1, so, x0 = 0, x1 = x0 + (1)h =
0 + (1)(0.1) = 0.1, x2 = x0 + (2)h = 0 + (2)(0.1) = 0.2, x3 = x0 + (3)h =
0 + (3)(0.1) = 0.3, x4 = x0 + (4)h = 0 + (4)(0.1) = 0.4, x5 = x0 + (5)h =
0 + (5)(0.5) = 0.4 and x6 = 0.6. The values of the function at the
integration nodes are:
f0 = 1, f1 = 1.01005017, f2 = 1.04081078, f3 = 1.09417428, f4 = 1.17351087,
f5 = 1.28402542, f6 = 1.43332941.
Z x6 Z 0.6
2 6
f (x) dx = ex dx = h[11f1 − 14f2 + 26f3 − 14f4 + 11f5 ]
x0 0 20
6
= (0.1)[11(1.01005017) − 14(1.04081078) + 26(1.09417428) −
20
14(1.17351087) + 11(1.28402542)] = 0.68048579.
9 Mohammad Sabawi/Numerical Analysis