Lecture 18
Lecture 18
Panchatcharam Mariappan1
1 Associate Professor
1
Recap
b n
X
f (x)dx ≈ Ai f (xi ) (1)
a i=0
b−a ad − bc
λ : [c, d] → [a, b], λ(x) = x+
d−c d−c
b d
b−a
f (x)dx = f (λ(u))du
a d−c c
b 1
λ : [0, 1] → [a, b], λ(x) = (b − a)x + a =⇒ f (x)dx = (b − a) f (λ(u))du (2)
a 0
b 1
1 1 1
λ : [−1, 1] → [a, b], λ(x) = (b − a)x + (a + b), f (x)dx = (b − a) f (λ(u))du
2 2 a 2 −1
(3)
2
Recap
Trapezoidal Rule:
b
h
f (x)dx ≈ [f (a) + f (b)]
a 2
Simpson’s 1/3rd Rule
b
h
f (x)dx ≈ [f (a) + 4f (a + h) + f (b)]
a 3
3
Open Newton-Cotes Formula
• The open Newton-Cotes formula do not include the endpoints [a, b] as
nodes.
• They use only interior nodes.
• The numerical approximation for open Newton-Cotes formula is same as
(1), but, xi ∈ (a, b).
• In order to use the same formula (1), we redefine the points by spacing as
follows: x−1 = a, x0 = a + h, xn+1 = b, xi = x0 + ih for each
i = 0, 1, 2, · · · , n where h = (b − a)/(n + 2).
4
Midpoint Rule
For the midpoint formula, we take n = 0, then x−1 = a, x0 = (a + b)/2, x1 = b.
Therefore, the interior point is only x0 = (a + b)/2. When we work on the
interval [0, 1], change of intervals and method of undetermined coefficients,
we obtain that 1
1
f (x)dx ∼ A
= 0 f (4)
0 2
By the method of undetermined coefficients, we evaluate them on 1.
1
f (x) = 1 : dx = A0 =⇒ A0 = 1
0
5
Midpoint Rule
The resulting formula is 1
1
f (x)dx ≈ f (5)
0 2
By (2), we obtain that
b 1
1
f (x)dx = (b − a) f (λ(u))du ∼
= (b − a)A0 f λ
a 0 2
a+b
≈ (b − a)f
2
If h = (b − a)/2, then
b
f (x)dx ≈ 2hf (a + h)
a
6
Two-Point Newton-Cotes Open Rule
For the Two-point formula, we take n = 1, then
x−1 = a, x0 = (a + b)/3, x0 = 2(a + b)/3, x2 = b. Therefore, the interior points
are only x0 = (a + b)/3 and x1 = 2(a + b)/3. When we work on the interval
[0, 1], change of intervals and method of undetermined coefficients, we obtain
that 1
∼ 1 2
f (x)dx = A0 f + A1 f (6)
0 3 3
7
Two-Point Newton-Cotes Open Rule
By the method of undetermined coefficients, we evaluate them on {1, x}.
1
f (x) = 1 : dx = A0 + A1 =⇒ A0 + A1 = 1
0
1
1 2 1 2 1
f (x) = x : xdx = A0 + A1 =⇒ A0 + A1 =
0 3 3 3 3 2
8
Two-Point Newton-Cotes Open Rule
The resulting formula is
1
1 1 1 2
f (x)dx ≈ f + f (7)
0 2 3 2 3
9
Two-Point Newton-Cotes Open Rule
If h = (b − a)/3, then
b
3h
f (x)dx ≈ [f (a + h) + f (a + 2h)]
a 2
10
Error in Midpoint and Two-Point Newton-Cotes
Open Rule
(b − a)3 ′′
f (ξ)
24
for some ξ ∈ (a, b)
Theorem 2 (Error in Two-point Newton-Cotes Open Rule)
If f ∈ C 2 [a, b], then the error in Two-point rule is given by
(b − a)3 ′′
f (ξ)
36
for some ξ ∈ (a, b)
11
Midpoint Rule
Example 3
Evaluate 1
2
e−x dx
0
using Midpoint rule.
a+b a+b
a = 0, b = 1, = 0.5, f = 0.7788
2 2
1
2
e−x dx = (1 − 0)f (0.5) = 0.7788
0
12
Two-Point Newton-Cotes Open Rule
Example 4
Using Two-Point Newton-Cotes open rule, the following numerical integration
can be obtained.
2
2
x2 dx = 3−0 4
2 [9 + 16
9 ] = 10
3 , Et =
3
3
0
1 3−0
dx = 2 [0.5 + 13 ] = 1.25, Et = 0.1363
1+x
3p 0
√ √
3−0
1 + x2 dx = 2 [ 2+ 5] = 5.0673, Et = −0.5853
0
3
ex dx = 3−0
2 [e + e2 ] = 15.16, Et = 3.9246
0
13
Some Open
Newton-Cotes Formula
14
Some Open Newton-Cotes Formula
When n = 0, open Newton-Cotes formula provides Midpoint rule. Similarly,
when n = 1, it yields the two-point Newton-Cotes open rule. When n = 3, the
following three point Newton-Cotes open rule is obtained
b
4h
f (x)dx ≈ [2f (a + h) − f (a + 2h) + 2f (a + 3h)]
a 3
with error as
14 5 (4)
E3 (t) = h f (ξ), ξ ∈ (a, b)
45
15
Some Open Newton-Cotes Formula
When n = 4, we obtain the following four-point Newton-Cotes open rule
b
5h
f (x)dx ≈ [11f (a + h) + f (a + 2h) + f (a + 3h) + 11f (a + 4h)]
a 24
16
Some Open Newton-Cotes Formula
When n = 5, we obtain the following five-point Newton-Cotes open rule
b
6h
f (x)dx ≈ [11f (a + h) − 14f (a + 2h) + 26f (a + 3h) − 14f (a + 4h) + 11f (a + 5h)]
a 20
17
Some Open Newton-Cotes Formula
Theorem 5
Suppose that (1) denotes the open Newton-Cotes formula with x−1 = a, xn+1 =
b, x0 = a + h, xi = x0 + ih, i = 0, 1, 2, · · · , n where h = (b − a)/(n + 2). There
exists ξ ∈ (a, b) for which
b n
X
f (x)dx = Ai f (xi ) + En (t)
a i=0
19
Composite Rules
• The Newton-Cotes formulas are generally unsuitable for use over large
integration intervals.
• High-degree formulas would be required and the values of these
formulas are difficult to obtain.
• Also, the Newton-Cotes formulas are based on interpolation polynomials
that use equally spaced nodes, a procedure that is inaccurate over large
intervals because of the oscillatory nature of high-degree polynomials,
• Remedy: a piecewise approach to numerical integration that uses the
low-order Newton-Cotes formulas.
• These are the techniques most often applied.
20
Composite Rules
Theorem 6
Suppose that c ∈ [a, b], then
b c b
f (x)dx = f (x)dx + f (x)dx
a a c
21
Composite Rules
Then we can apply the basic rules in each subinterval [xi , xi+1 ], that is,
xi+1 m
X
f (x)dx = Aj f (xj )
xi j=0
22
Composite trapezoidal Rule
The composite trapezoidal rule is obtained by keeping the m = 2 in (8). That
is, xi+1
h
f (x)dx ≈ [f (xi ) + f (xi+1 )]
xi 2
and
b n−1
hX
f (x)dx ≈ [f (xi ) + f (xi+1 )] (9)
a 2
i=0
23
Composite trapezoidal Rule
For each interval [xi , xi+1 ], the error is given by
h3 ′′
Eti = − f (ξi )
12
Therefore, the error of the composite trapezoidal rule is obtained as
n−1
h3 X ′′
Et = − f (ξi ) = O(h2 )
12
i=0
25
Composite trapezoidal Rule
Example 7
If the composite trapezoidal rule is to be used to compute
1
2
e−x dx
0
1−0 2 1
− h 2 ≤ × 10−4 =⇒ h ≤ 0.01733
12 2
As h = 1/n, we need at least 59 or more points to obtain the desired accuracy.
27
Composite Simpson’s 1/3 Rule
The composite Simpson’s 1/3 rule is obtained by keeping the m = 3 in (8).
xi+1
h xi + xi+1
f (x)dx ≈ [f (xi ) + 4f + f (xi+1 )]
xi 3 2
28
Composite Simpson’s 1/3 Rule
*Now choose n such that n is divisible by 2, then
b n−1
hX xi + xi+1
f (x)dx ≈ [f (xi ) + 4f + f (xi+1 )] (11)
a 3 2
i=0
h5 (4)
Eti = − f (ξi )
90
29
Composite Simpson’s 1/3 Rule
Therefore, the error of the composite Simpson’s rule is obtained as
n−1
h5 X (4)
Et = − f (ξi ) = O(h4 )
90
i=0
When n is divisible by 2, the composite Simpson’s 1/3 rule can also be written
as
b n/2 (n−2)/2
X X h
f (x)dx ≈ 4 [f (a+ (2i−1)h)] + 4 [f (a+ 2ih)] + [f (a) +f (b)] (12)
a 3
i=1 i=1
30
Composite Simpson’s 1/3 Rule
Example 8
The calculation of work is an important equation in science and engineering.
The general formula is given by
Although, this formula seems to be simple, when apply this to realistic problem,
we obtain a complicated function. For example, when the force varies during
the course of calculation which results in
xn
W = F (x)dx
x0
31
Composite Simpson’s 1/3 Rule
When the angle between the force and direction of the movement also varies
as a function of position, we obtain that
xn
W = F (x) cos(θ(x))dx
x0
The following table shows the force and angle as a function of position x.
x 0 5 10 15 20 25 30
F (x), N 0.0 9.0 13.0 14.0 10.5 12.0 5.0
θ(x), rad 0.50 1.40 0.75 0.90 1.30 1.48 1.50
Evaluate W using the Simpson’s 1/3 rule and composite Simpson’s 1/3 rules
32
Composite Simpson’s 1/3 Rule
Solution:
By Simpson’s rule, we have h = (30 − 0)/2
15
W = [F (0) cos(θ(0)) + 4F (15) cos(θ(0.9)) + F (30) cos(θ(1.50))]
3
= 5[0 + 34.81 + 0.3537] = 175.82
By composite Simpson’s 1/3 rule, we have h = (30 − 0)/6
5
W = [F (0) cos(θ(0)) + 4F (5) cos(θ(1.4)) + F (10) cos(θ(0.75))]
3
5
+ [F (10) cos(θ(0.75)) + 4F (15) cos(θ(0.90)) + F (20) cos(θ(1.30))]
3
5
+ [F (20) cos(θ(1.30)) + 4F (25) cos(θ(1.48)) + F (30) cos(θ(1.50))]
3
= 117.13
33
Composite Midpoint Rule
Let f ∈ c2 [a, b], n be even, h = (b − a)/(n + 2) and xi = a + (i + 1)h for each
i = −1, 0, · · · , n + 1. Then the composite midpoint rule is given by
b n/2
X
f (x)dx ≈ 2h f (x2i ) (13)
a i=0
b − a 2 ′′
h f (ζ), ζ ∈ (a, b)
6
34
Merits and Demerits of
Newton-Cotes Rules
35
Merits and Demerits
• Simpson’s 1/3 rule has less truncation error compare to Simpson’s 3/8
rule.
• However, 3/8 rule requires 4 points and 1/3 rule requires only 3 points for
the evaluation.
• In composite rule, with (6n + 1) points, the truncation error of 1/3 rule will
be better than 3/8 rule.
• In general, Newton-Cotes formula has no advantage on even number of
points.
36
Merits and Demerits
• Besides the formulas with even number of points are useful for
integrating tabulated functions.
• Simpson’s 1/3 rule is usually the method of preference because it attains
third order accuracy with three points rather than the four points required
for the 3/8 version.
• However, the 3/8 rule has utility when the number of segments is odd.
• We can use Simpson’s rule to integrate the function for four segments.
37
Merits and Demerits
• Suppose that you desired an estimate for five segments. One option
would be composite trapezoidal rule.
• This may not be advisable, however, because of the large truncation error
associated with this method.
• An alternative would be to apply Simpson’s 1/3 rule to the first two
segments and Simpson’s 3/8 rule to the last three
• In this way, we could obtain an estimate with third-order accuracy across
the entire interval.
• One of the main disadvantage of composite Simpson’s 1/3 rule is that an
even number of intervals must be utilized to implement the method.
38
Merits and Demerits
• If the function is known only in table form, it is most convenient to use
Newton-Cotes formula.
• The composite trapezoidal rule is most convenient for even when the
table contains unequally spaced points.
• Notice that, as was the case with Simpson’s 1/3 and 3/8 rules, the five
and six point rules have the same order error.
• This general characteristic holds for the higher point rules and leads to
the result that the even-segment–odd-point formulas (for example, 1/3
rule and Boole’s rule) are usually the methods of preference.
• However, it must also be stressed that, in engineering practice, the
higher-order (that is, greater than four-point) formulas are rarely used.
39
Merits and Demerits
• Simpson’s rules are sufficient for most applications.
• Accuracy can be improved by using the composite rules.
• Newton-Cotes rule uses evenly spaced points in the interval.
• It uses a polynomial of minimal degree and exploits the Lagrange
interpolation.
• When Newton-Cotes formula uses n nodes, it is exact for polynomials of
degree at most n − 1.
• Since higher order methods are based on Lagrange interpolation, they
suffer from ill-conditioned.
• It can produce negative Ai .
40
Merits and Demerits
• It has limited applications due to failure of some function where the
problem arises from the assumption that the interpolation points are
uniformly spaced.
• Alternatively, the Gaussian quadrature does not require uniformly spaced
points as discussed in the next chapter.
• Furthermore, when the function is known and high accuracy is required,
methods such as Romberg integration or Gauss quadrature are
recommended.
41
Thanks
Doubts and Suggestions
[email protected]
42
MA206L-Numerical Methods
Lecture 18: Numerical Integration - Newton-Cotes
Panchatcharam Mariappan1
1 Associate Professor
42