0% found this document useful (0 votes)
40 views24 pages

Chapter 4

This document discusses numerical methods for finding the approximate real roots of equations. It covers the method of fixed point iteration, including defining the iterative function, proving convergence, and estimating errors. Examples are provided to demonstrate applying the method to specific equations.

Uploaded by

Oh God
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views24 pages

Chapter 4

This document discusses numerical methods for finding the approximate real roots of equations. It covers the method of fixed point iteration, including defining the iterative function, proving convergence, and estimating errors. Examples are provided to demonstrate applying the method to specific equations.

Uploaded by

Oh God
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Associate Degree 2023 – 2024 Second Semester

CCMA4003 Calculus

Chapter 4
Numerical Methods

4.1 Numerical Solution of Equation

In scientific and engineering work, a frequently occurring problem is to find the roots of
an equation of the form f(x) = 0. It is known that if f(x) is quadratic or cubic then algebraic methods
for exact solutions are available. However, if f(x) is a polynomial of degree higher than three,
then algebraic methods are not easily available.

In this section, we will find the approximate real roots by numerical methods, namely,
method of fixed point iteration and Newton’s method.

Location of real root

Before we apply any numerical method to find the approximate root of an equation f(x) = 0,
we first show that there is a unique real root  in an interval [a, b] by the following theorem.

Theorem If f(x) is continuous on [a, b] and differentiable on (a, b) such that


(1) f(a)f(b) < 0 and
(2) either f’(x) > 0 or f’(x) < 0 on [a, b]
then there exists unique  in (a, b) such that f(  ) = 0.

4-1
A. Method of Fixed Point Iteration

Most numerical methods are iterative in nature and start from one or two initial guesses to the root.
They produce a sequence x0, x1, x2,…, xn,… which will presumably converges to the desired root.

Let  in [a, b] be the unique root of the equation f(x) = 0.


Rewrite f(x) = 0 in the form x = g(x) where g(x) is called the iterative function.
The method of fixed point iteration generates a sequence {xn} where
x n  g(x n 1 ) for n = 1, 2, 3, …
with any initial guess x 0 in [a, b].

Theorem If g(x) is continuous on [a, b] and the sequence {xn} converges to a point m in (a, b),
then m   .

Remark:

1. m = lim x n = lim g(x n 1 ) = g(lim x n 1 ) = g (m)


n  n  n 

∴ f(m) = 0
Since there is only one root in [a, b], we have m   .

2. We called m to be the fixed point of g(x).

4-2
Theorem Contraction Mapping Theorem

Let g(x) and g’(x) be continuous on [a, b], assume g(a)  a and g(b)  b , such that
(1) a  g(x)  b for all x in [a, b] and
(2) there exists a positive constant K such that max g' ( x ) = K < 1
a  x b

Then the following statements are true:

(a) There is a unique solution  to the equation x = g(x) in (a, b).


(b) For any initial guess x 0 in [a, b], the sequence {xn} generated by
x n  g(x n 1 ) for n = 1, 2, 3, …
will converges to  .

Remark:

1. Let f(x) = x – g(x).


Then f(a) = a – g(a) < 0, f(b) = b – g(b) > 0 and f’(x) = 1 – g’(x) > 0.

2. Mean Value Theorem


If a function f is continuous on the closed interval [a, b] and differentiable on the open interval (a, b),
then there exists a point c in (a, b) such that
f (b)  f (a)
f '(c)  or f (b)  f (a)  f '(c)(b  a)
ba

A secant line of a curve is a line that (locally) intersects two points on the curve.

3. x n    g(x n 1 )  g()
 g '(c)(x n 1  ) (by Mean Value Theorem)
 K x n 1  
 K  K x n 2   
 K 2 x n 2  

 Kn x0  
 K n (b  a)  0 as n  

4-3
Example 1

(a) Show that the equation x3  2x  5  0 has a unique root  in [1, 3].
(b) Suppose that the iteration formula x n  g(x n 1 )  3 2x n 1  5 for n = 1, 2, 3, … is used to estimate
the value of  .
(i) Show that 1  g(x)  3 for all x in [1, 3].
(ii) Find K  max g '(x) correct to 3 decimal places.
1 x 3

(c) Hence, with (i) x 0  2 and (ii) x 0  2.5 , estimate the value of  correct to 5 decimal places.

Solution:

(a) Let f (x)  x3  2x  5


∵ f (1)  (1)3  2(1)  5  6  0 , f (3)  (3)3  2(3)  5  16  0 and f '(x)  3x 2  2  0 on [1, 3].
∴ The equation has a unique root  in [1, 3].

2
1  2
(b) Let g(x)  2x  5 . Then g '(x)  (2x  5) 3 (2) 
3
2
.
3
3(2x  5) 3

(i) ∵ g’(x) > 0 on [1, 3]


∴ g is increasing on [1, 3], i.e. g(1)  g(x)  g(3)

where g(1)  3 2(1)  5  3 7  1.91  1 and g(3)  3 2(3)  5  3 11  2.22  3

Hence 1  g(x)  3 for all x in [1, 3].


2 2
(ii) K  max g '(x)  g '(1)  2
 2
 0.182 < 1
1 x 3
3[2(1)  5] 3
3(7) 3

Hence by Contraction Mapping Theorem, the sequence of iterates {xn} will converges to  for any
initial guess x 0 in [1, 3].

(c) (i) n xn correct to 5 d.p. (ii) n xn correct to 5 d.p.


0 2 0 2.5
1 2.080083823 2.08008 1 2.15443469 2.15443
2 2.092350678 2.09235 2 2.103612029 2.10361
3 2.094216996 2.09422 3 2.09592741 2.09593
4 2.094500652 2.09450 4 2.094760545 2.09476
5 2.094543758 2.09454 5 2.09458325 2.09458
6 2.094550308 2.09455 6 2.094556309 2.09456
7 2.094551303 2.09455 7 2.094552215 2.09455
8 2.094551454 2.09455 8 2.094551593 2.09455
9 2.094551477 2.09455 9 2.094551498 2.09455

∴ The estimated value of  is 2.09455 (correct to 5 d. p.)


4-4
Properties of Method of Fixed Point Iteration

(1) The fixed point iteration is one point iteration where only one starting value x 0 is required.

As a general rule, try to find an interval in which a root lies and then choose as a starting point, x 0 ,
either (i) one of the end-points of the interval, or
(ii) the mean value of the two end-points of the interval.

(2) (i) if g ' ( ) < 1, the sequence x0, x1, x2,… will converge to a root of f(x) = 0.

In particular,
(a) if –1 < g’(  ) < 0 then the sequence x0, x1, x2,… will oscillate and converge towards a root
of f(x) = 0 and
(b) if 0 < g’(  ) < 1 then the sequence x0, x1, x2,… will converge, without oscillating, towards
a root of f(x) = 0.

(ii) if g ' ( )  1 then the sequence x0, x1, x2,… will diverge.

Remark:

1. To neglect the rounding off error, we should keep as many as possible the number of decimal places
in each iterate xn. Otherwise, rounding errors will propagate throughout every iterate to affect the
final conclusion.

2. To show that a  g(x)  b for all x in [a, b], we examine the monotonic property of g(x) on [a, b].

g g min g max
↗ g(a) g(b)
↘ g(b) g(a)

3. To find K  max g '(x) , we examine the monotonic property of g’(x) on [a, b].
a x b

g’(x)
↗ ↘
0 0 0 0

K  max g '(x) g’(b) – g’(a) g’(a) – g’(b)


a x b

4-5
Error Estimate in Method of Fixed Point Iteration

To better understand the accuracy of the estimate of root of an equation, we study the error estimation
formula as follows:

K
Theorem In the nth iteration, x n    x n  x n 1 for n = 1, 2, 3, …,
1 K

where (0 )K  max g '(x)  1 .


a  x b

Proof:

x n    g(x n 1 )  g()
 g '(c) x n 1   (by Mean Value Theorem)
 K x n 1  
 K x n 1  x n  x n  
 K x n 1  x n  K x n   (by Triangle Inequality)

Hence (1  K) x n    K x n  x n 1
K
xn    x n  x n 1 (∵ 1 – K > 0)
1 K

This is a practical way to estimate the error bound of the estimation of the root  by xn.

Kn
Theorem In the nth iteration, x n    x 1  x 0 for n = 1, 2, 3, …,
1 K
where (0 )K  max g '(x)  1 .
a  x b

Proof:

x n  x n 1  g(x n 1 )  g(x n  2 )  g '(c)(x n 1  x n 2 )  K x n 1  x n 2   K n 1 x1  x 0

Hence (1  K) x n    K x n  x n 1  K n x1  x 0

Kn
∴ xn    x1  x 0 (∵ 1 – K > 0)
1 K

This is a practical way to find the number of iteration required to guarantee to get
an estimate with certain accuracy.
4-6
Example 2

(a) Show that the equation e x  x  0 has a unique root  in [0.5, ln 2].
(b) Suppose that the iteration formula x n  g(x n 1 )  e x n1 for n = 1, 2, 3, … is used to estimate
the value of  .
(i) Show that 0.5  g(x)  ln 2 for all x in [0.5, ln 2].
(ii) Find K  max g '(x) .
0.5 x  ln 2

(c) (i) With x 0  0.5 , find the value of  correct to 4 decimal places.
(ii) Show that the error bound in estimating  by the iterate x 6 is less than 9.73  10-3.
(iii) Find the least number of iterations required to give the estimate of  correct to 4 decimal places.

Solution:

(a) Let f (x)  e x  x


∵ f (0.5)  e0.5  0.5  0.11  0 , f (ln 2)  e ln 2  ln 2  0.19  0
and f '(x)  e x 1  0 on [0.5, ln 2]
∴ The equation has a unique root  in [0.5, ln 2].

(b) Let g(x)  e x . Then g '(x)  e x .

(i) ∵ g’(x) < 0 on [0.5, ln 2]


∴ g is decreasing on [0.5, ln 2], i.e. g(ln2)  g(x)  g(0.5)
1
where g(ln 2)  e  ln 2  e ln 2  21  0.5 and g(0.5)  e0.5  0.6065  ln 2

Hence 0.5  g(x)  ln 2 for all x in [0.5, ln2].

(ii) ∵ g’(x) is increasing and < 0 on [0.5, ln 2]

∴ K  max g '(x)  g '(0.5)  e0.5  0.6065 ( 1)


0.5 x ln 2

4-7
(c) (i) n xn correct to 4 d.p. n xn correct to 4 d.p.
0 0.5 11 0.567277196 0.5673
1 0.606530659 0.6065 12 0.567067351 0.5671
2 0.545239211 0.5453 13 0.56718636 0.5672
3 0.579703094 0.5797 14 0.567118864 0.5671
4 0.560064627 0.5601 15 0.567157143 0.5672
5 0.571172149 0.5712 16 0.567135433 0.5671
6 0.564862947 0.5649 17 0.567147746 0.5671
7 0.568438047 0.5684 18 0.567140763 0.5671
8 0.566409452 0.5664 19 0.567144723 0.5671
9 0.567559634 0.5676 20 0.567142477 0.5671
10 0.566907212 0.5669 21 0.567143751 0.5671

∴ The estimated value of  is 0.5671 (correct to 4 d. p.)

(ii) For n = 6,
K e0.5
x6    x6  x5 = 0.5
0.564862947  0.571172149  9.7256 10 3  9.73 10 3
1 K 1 e

Kn
(iii) The error bound in estimation of  by xn is x1  x 0
1 K
1
Since the error tolerance is 104  5 105 ,
2
Kn
set x 1  x 0  5  10-5
1 K
e 0.5 n

0.606530659  0.5  5 105


1  e0.5
e 
0.5 n
 1.8467 104
ln(1.8467 104 )
n
ln(e 0.5 )
n  17.19
Hence the least number of iterations required is 18.

Remark:

1. We should retain more significant figures in each xn for error analysis as there will be a loss of
number of significant figures in difference between two approximately equal numbers.

2. Since –1 < g’(  ) < 0


∴ {xn} is oscillating convergent to  .
4-8
B. Newton’s Method

Consider the smooth graph with an equation y = f(x). The root  is at the point where the graph
meets the x-axis. We will usually have an estimate of  , and it will be denoted by x 0 (initial guess).
To improve the accuracy of this estimate, we consider the tangent to the graph at the point (x 0 ,f (x 0 )) .
If x 0 is near  then this tangent line will meet the x-axis at some point x1 nearer to  where
f (x 0 ) 0  f (x 0 )
x1  x 0  as  f '(x 0 )
f '(x 0 ) x1  x 0

Since x1 is an improvement over x 0 as an estimate of  , this entire procedure can be repeated with x1
as the initial approximation. This leads to the new estimate
f (x1 )
x 2  x1 
f '(x1 )
Repeating this process, we obtain a sequence of iterates {xn} defined by the iterative formula
f (x n 1 )
x n  x n 1  for n = 1, 2, 3, …
f '(x n 1 )

This is the Newton’s method for estimation of roots of the equation f(x) = 0.

Theorem Newton’s Method


Let f(x) have twice continuous derivatives on [a, b] which contains the unique root  of
the equation f(x) = 0, i.e. f’(  )≠0.
The sequence of iterates defined by Newton’s iterative formula
f (x n 1 )
x n  x n 1  for n = 1, 2, 3, …
f '(x n 1 )
will converge to  for any initial guess x 0 sufficiently close to  .

4-9
Example 3

It is known that the equation e x  x  0 has a root  near 0.5.


Use Newton’s method to estimate the value of  correct to 6 decimal places.

Solution:

Let f (x)  e x  x
Then f '(x)  e x 1

The iterative formula is


f (x n 1 )
x n  x n 1 
f '(x n 1 )
e  x n1  x n 1
 x n 1 
e  x n1  1
e  x n1  x n 1
 x n 1   x n1
e 1
 x n 1
x e  x n 1  e  x n1  x n 1
 n 1
e  x n1  1
(x n 1  1)e  x n1

e  x n1  1
(x n 1  1)e  x n1
 e  x n1
 x n 1
e 1
 x n 1
e
x n 1  1
 x n1 for n = 1, 2, 3, …
e 1

With x 0  0.5 ,
we have x1  0.566311003
x 2  0.567143165
x 3  0.56714329
x 4  0.56714329
x 5  0.56714329

∴ The estimated value of  is 0.567143 (correct to 6 d.p.)

4-10
Remark:

1. To estimate a root, Newton’s method is more effective than method of fixed point iteration.

With x 0  0.5 , by using the iterative formula x n  g(x n 1 )  e x n1 , n = 1, 2, 3, …, we have

n xn correct to 6 d.p.
0 0.5
1 0.606530659 0.606531
2 0.545239211 0.545239
3 0.579703094 0.579703
4 0.560064627 0.560065
5 0.571172149 0.571172
6 0.564862947 0.564863
7 0.568438047 0.568438
8 0.566409452 0.566409
9 0.567559634 0.567560
10 0.566907212 0.566907
11 0.567277196 0.567277
12 0.567067351 0.567067
13 0.56718636 0.567186
14 0.567118864 0.567119
15 0.567157143 0.567157
16 0.567135433 0.567135
17 0.567147746 0.567148
18 0.567140763 0.567141
19 0.567144723 0.567145
20 0.567142477 0.567142
21 0.567143751 0.567144
22 0.567143029 0.567143
23 0.567143438 0.567143
24 0.567143206 0.567143
25 0.567143338 0.567143
26 0.567143263 0.567143
27 0.567143305 0.567143

1
2. Since the error tolerance is 106  5 107 ,
2
Kn
set x1  x 0  5 107
1 K
(e0.5 )n
we have 0.5
0.606530659  0.5  5 107
1 e
(e 0.5 ) n  1.846742782 10 6
ln(1.846742782 10 6 )
n
ln(e 0.5 )
n  26.40

Hence the least number of iterations required is 27.


4-11
Theorem Let f(x) have twice continuous derivatives on [a, b] and  is the unique root in [a, b].
If (1) f(a)f(b) < 0 and
(2) either f’(x) > 0 or f’(x) < 0 on (a, b)
∴  is the unique root in [a, b] and
(3) either f’’(x) > 0 or f’’(x) < 0 on [a, b] and
f (a ) f ( b)
(4)  b – a and b–a
f ' (a ) f ' ( b)
Then the sequence of Newton’s iterates converges to  for any initial guess x 0 in [a, b].

Example 4

Let f (x)  x 6  x 1 .
(a) Show that the equation f(x) = 0 has a unique root  in [1, 2].
5x 6  1
(b) Show that the Newton’s iterative formula is x n  n5 1 for n = 1, 2, 3, ….
6x n 1  1
(c) Show that the sequence of Newton’s iterates converges to  for any initial guess x 0 in [1, 2].
Hence, with x 0  1.1 , find the value of  correct to 7 decimal places.

Solution:

(a) f (1)  16 1 1  1  0 , f (2)  26  2 1  61  0 and f '(x)  6x5 1  0 on [1, 2].


∴ The equation has unique root  in [1, 2].

(b) The Newton’s iterative formula is given by


f (x n 1 ) x 6  x  1 6x 6n 1  x n 1  x n6 1  x n 1  1 5x n6 1  1
x n  x n 1   x n 1  n 1 5 n 1   5 for n = 1, 2, 3, …
f '(x n 1 ) 6x n 1  1 6x 5n 1  1 6x n 1  1

(c) ∵ f ''(x)  30x 4  0 on [1, 2],


f (1) 1 1 f (2) 61 61
   2  1 and    2 1
f '(1) 6(1)  1 5
5
f '(2) 6(2)  1 191
5

∴ The sequence of Newton’s iterates converges to  for any initial guess x 0 in [1, 2].

n xn correct to 7 d.p.
0 1.1 (say),
1 1.137912585 1.1379126
2 1.13474852 1.1347485
3 1.13472414 1.1347241
4 1.134724138 1.1347241
5 1.134724138 1.1347241

∴ The estimated value of  is 1.1347241 (correct to 7 d.p.)

Remark: x n  g(x n 1 )  6 x n 1  1 , n = 1, 2, 3, …
4-12
4.2 Numerical Integration
By fundamental theorem of calculus, we can evaluate the definite integral by first finding
the primitive function F(x) of the integrand f(x) so that

f ( x ) dx = F( x )a = F(b) – F(a)


b

b
a

sin x 1

2
 e  x dx cannot be evaluated
2
However, most definite integrals for example dx and
1 x 0

analytically in this way because most integrands do not have anti-derivatives expressible in terms
of elementary functions.

In this section, we will study two fundamental numerical methods of integration, namely,
Trapezoidal rule and Simpson’s rule.

A. Trapezoidal Rule

In the trapezoidal rule, we approximate the function f(x) in the interval [a, b] by a straight line
through the end points.

b
 a
f ( x ) dx is approximated by the area of a trapezium.

In the figure shown,


b
 a
f ( x ) dx  area of trapezium ABQP

1
= (b  a )(AP  BQ)
2
1
= (b  a )[f (a )  f (b)]
2

Usually the function f(x) is such that a single straight line for the whole interval is not a good
enough approximation. In such cases we divide the interval [a, b] into n equal subintervals,
by the points x0 = a, x1, x2,…, xn = b and apply the trapezoidal rule for each subinterval.
We get the composite trapezoidal rule.

4-13
Theorem Composite Trapezoidal Rule
b ba
Let I =  f ( x ) dx. The interval [a, b] is divided into n equal subintervals of width h  .
a n
Define xi  a  ih and yi  f (xi ) for i = 0, 1, 2,…, n.
The estimate of I is given by Tn where
h
Tn = [(y0 + yn) + 2(y1 + y2 + … + yn-1)]
2

Proof:

Tn = sum of n trapezoidal areas


h h h h
= (y0 + y1) + (y1 + y2) + (y2 + y3) + … + (yn-1 + yn)
2 2 2 2
h
= [(y0 + yn) + 2(y1 + y2 + … + yn-1)]
2

The estimate of I is Tn .

Remark: 1. If f(x) is concave down on [a, b],


i.e., f "(x)  0 for all x in [a, b],
b
then the trapezoidal rule gives an under-estimate of  a
f ( x ) dx.

2. If f(x) is concave up on [a, b],


i.e., f "(x)  0 for all x in [a, b],
b
then the trapezoidal rule gives an over-estimate of  a
f ( x ) dx.

b
3. The trapezoidal rule gives the exact value of  a
f ( x ) dx when f(x) is a linear polynomial.

4. In general, the approximation is better if the number of sub-intervals is larger.

4-14
Example 5

2
Find I   ln x dx, correct to 4 decimal places, using the trapezoidal rule with 5 subintervals.
1

Is it an overestimate or an underestimate of I? Explain your answers.

Solution:

2 1
For n = 5, h   0.2 . Then
5

i xi yi  ln xi
0 1 0
1 1.2 0.182321556
2 1.4 0.336472236
3 1.6 0.470003629
4 1.8 0.587786664
5 2 0.69314718

2 0 .2
I   ln x dx  T5 = [(y0 + y5) + 2(y1 + y2 + y3 + y4 )]
1 2
= 0.1[0 + 0.69314718 + 2(0.182321556 + 0.336472236 + 0.470003629 + 0.587786664) ]
= 0.384631535
= 0.3846 (correct to 4 decimal places)

Since f "(x)  x 2  0 on [1, 2], f(x) is concave down on [1. 2].


∴ T5 is an underestimate of I.

ln x dx = x ln x  x 1
2

2
Remark: The exact value of ( Using Integration by Parts,
1
Choose f(x) = ln x and g’(x) = 1 )

= (2ln 2  2)  (1ln1 1)


= 2 ln 2 – 1
= 0.386294361

4-15
Error Estimation in Trapezoidal Rule

Theorem Let f(x) have twice continuous derivatives on [a, b] and n be any positive integer.
b
The error in estimating the value of  a
f ( x ) dx using trapezoidal rule

with n equal subintervals is given by

(b  a)h 2 ba
E n  I  Tn   f "(c) for some c in [a, b] and h =
12 n

Remark: 1. Since c is an unknown in [a, b], we estimate an error bound of En as follows:

(b  a)h 2 (b  a)h 2 (b  a)3


En   f "(c)  M2  M2
12 12 12n 2

ba
where M 2 = max f "(x) and h 
a x b n

2. To find M 2  max f "(x) , we examine the monotonic property of f "(x) on [a, b].
a  x b

If f "(x) is ↗ or ↘ on [a, b], then M 2  max{ f "(a) , f "(b) }

(i) if f "(x) is ↗ and ≥ 0 on [a, b], then M2  f "(b)

(ii) if f "(x) is ↗ and ≤ 0 on [a, b], then M2  f "(a)

(iii) if f "(x) is ↘ and ≥ 0 on [a, b], then M2  f "(a)

(iv) if f "(x) is ↘ and ≤ 0 on [a, b], then M2  f "(b)

4-16
Example 6

1
(a) Estimate the value of I =  e x dx using the trapezoidal rule with 5 subintervals.
0

Give your answer in 4 decimal places.

(b) (i) Show that the error bound in (a) is less than 0.009061.
(ii) Is it an overestimate or an underestimate of I? Explain your answer.

Solution:

(a) For n = 5
1 0
h= = 0.2
5
1 0 .2 0 1
 0
e x dx  T5 =
2
[(e + e ) + 2(e0.2 + e0.4 +e0.6 + e0.8 )] = 1.72400562

∴ The estimate of I is 1.7240 (correct to 4 decimal places)

(b) (i) Let f (x)  ex . Then f '(x)  ex and f "(x)  ex .


∵ f "(x) is increasing and > 0 on [0, 1]

∴ M 2 = max f "(x)  f "(1)  e


0 x 1

(1  0)(0.2) 2 (1  0)3
Hence E 5 =  f ' ' (c)  2
(e)  9.060939428 103 < 0.009061 (∵ 0  c  1 )
12 12(5)

(ii) Since f "(x)  ex  0 on [0, 1], f(x) is concave up on [0, 1],


∴ T5 is an overestimate of I.

Procedures of estimation of numerical integral

b
The following steps are some standard procedures to estimate the value of I =  f ( x ) dx
a

by any numerical integration formula Tn correct to k decimal places:

(1) to determine the least number n of subintervals required by the numerical integration formula
1
so that E n  10 k  5 10 (k 1)
2
(2) to evaluate Tn correct to k decimal places

(3) to give the estimate of I with Tn


4-17
Example 7

1
(a) Find the least number of subintervals required by trapezoidal rule to give an estimate of I =  e  x dx
0

correct to 2 decimal places.


(b) Hence, find the value of I, correct to 2 decimal places.

Solution:

(a) Let f (x)  e x . Then f '(x)  e x and f "(x)  e x .


∵ f "(x) is decreasing and > 0 on [0, 1]

∴ M 2 = max f "(x)  f "(0)  e0  1


0 x 1

 1 0 
2

(1  0)  
 n  f "(c)  (1  0) (1) = 1
3
En =  (∵ 0  c  1 )
12 12n 2 12n 2

1
Since the error tolerance is 102  5 103 ,
2
1
we set En   5  103
12n 2
16.66666667  n 2
n  4.08

Hence the least number of subinterval required is 5.

(b) For n = 5
1 0
h= = 0.2
5
1 0.2 -0 -1
I   e x dx  T5 = [(e + e ) + 2(e- 0.2 + e- 0.4 + e- 0.6 + e- 0.8 )] = 0.634226224
0 2

∴ The estimate of I is 0.63 (correct to 2 d.p.)

1
Remark: The exact value of I =  e x dx   e x   (  e1 )  (e0 )  e1  1  0.632120558
1

0 0

4-18
B. Simpson’s Rule

To improve the estimate value of I by trapezoidal rule which is based on linear interpolation,
ab
we use quadratic polynomial P(x) interpolating the function f(x) at a, m  and b and give
2
(x  m)(x  b) (x  a)(x  b) (x  a)(x  m)
P(x)  f (a)  f (m)  f (b)
(a  m)(a  b) (m  a)(m  b) (b  a)(b  m)

The definite integral of P(x) over [a, b] is is given by


b h ab 
IS   P(x)dx   f (a)  4f    f (b) 
a 3  2  
ba
where h =
2

The estimate of I is IS .

Theorem Composite Simpson’s Rule


b
Let I =  f ( x ) dx. The interval [a, b] is divided into n = 2N equal subintervals of
a

ba ba
width h = =
n 2N
Define xi  a  ih and yi  f (xi ) for i = 0, 1, 2,…, 2N
The estimate of I is given by Sn where
h
Sn  S2N = [(y0 + y2N) + 4(y1 + y3 + … + y2N-1) + 2(y2 + y4 + … + y2N-2)]
3

Remark: The number of subintervals must be even.

4-19
Error Estimation in Simpson’s Rule

Theorem Let f(x) have four times continuous derivatives on [a, b] and n = 2N be any even positive integer.
b
The error in estimating the value of I   f (x) dx using Simpson’s rule with 2N subintervals
a

is given by
(b  a)h 4 (4) ba
E n  I  Sn   f (c) for some c in [a, b] and h =
180 n

Remark: 1. Since c is an unknown in [a, b], we estimate an error bound of En as follows:

(b  a )h 4 ( 4) (b  a)h 4 (b  a)5
En =  f ( c)  M4  M4
180 180 180n 4

ba
where M 4 = max f ( 4) (x) and h 
a xb n

2. To find M4  max f (4) (x) , we examine the monotonic property of f (4) (x) on [a, b].
a  x b

If f (4) (x) is ↗ or ↘ on [a, b], then M 4  max{ f (4) (a) , f (4) (b) }

(i) if f (4) (x) is ↗ and ≥ 0 on [a, b], then M 4  f (4) (b)

(ii) if f (4) (x) is ↗ and ≤ 0 on [a, b], then M4  f (4) (a)

(iii) if f (4) (x) is ↘ and ≥ 0 on [a, b], then M4  f (4) (a)

(iv) if f (4) (x) is ↘ and ≤ 0 on [a, b], then M 4  f (4) (b)

3. If f(x) is a polynomial of degree less than or equal 3,


then f ( 4) (x) = 0 for all x, i.e. En = 0.
Sn is an exact value of I.

4. If n   then En  0
The greater n is, the more accurate is Sn as an estimate of I.

5. If M 4 is large on [a, b] then Sn will be a poor estimate of I.

4-20
Example 8

3 1
(a) Estimate the value of I =  dx by Simpson’s rule with 8 subintervals.
1 x
Give your answer in 4 decimal places.

(b) Show that the error bound in (a) is less than 0.001042.

Solution:

(a) For n = 8
3 1
h= = 0.25
8
3 1 0.25  1 1   1 1 1 1   1 1 1 
I dx  S8      4      2     1.098725349
1 x 
3  1 3   1.25 1.75 2.25 2.75   1.50 2.00 2.50  

∴ The estimate of I is 1.0987 (correct to 4 d.p.)

1
(b) Let f(x) =
x
1
We have f (1) (x) = 
x2
2
f ( 2) (x ) =
x3
6
f (3) (x) = 
x4
24
and f ( 4) ( x) =
x5

Since f (4) (x) is decreasing and > 0 on [1, 3]


24
∴ M 4  max f (4) (x)  f (4) (1)   24
1 x 3 15

(3  1)(0.25) 4 ( 4) 2(0.25) 4 1
Hence E 8 =  f ( c)  (24) =  1.041666667 103  0.001042
180 180 960

(∵1c3)

4-21
Example 9

(a) Find the least number of subintervals required by Simpson’s rule to give the estimate of I   4 ex cos xdx
0
correct to 4 decimal places.
(b) Hence estimate the value of I.
Solution:

(a) Let f (x)  ex cos x


We have f (1) (x)  ex cos x  ex sin x  ex (cos x  sin x)
f (2) (x)  ex (cos x  sin x)  ex ( sin x  cos x)  2ex sin x
f (3) (x)  2ex sin x  2ex cos x  2ex (sin x  cos x)
f (4) (x)  2ex (sin x  cos x)  2ex (cos x  sin x)  4ex cos x
 
and f (5) (x)  4ex cos x  4ex sin x  4ex (cos x  sin x)  0 on 0, 
 4 

 
Since f ( 4) (x) is decreasing and < 0 on 0, 
 4 
 
  
∴ M 4  max f (4) (x)  f (4)    4e 4 cos  4e 4 cos
0 x 
 4 4 4
4
4 5
    
  0   0     
     4e 4 cos   
 f (c)    4
4 4 4
En =   ( 4)
(∵ 0c )
180 n 4
180n  4  4


5

    
Since the error tolerance is 104  5 105 , we set E n    4  4e 4 cos   5 105
1 4
2 180n  4
205.9899249  n 4
n  3.788449433

Hence the least even number of subinterval required is 4.



0
4 
(b) For n = 4, h = =
4 16

 0 
   16  3
3   8  
I  S4   e cos 0  e cos   4  e cos  e cos   2  e cos    1.050848337
16 4 16
3  4  16 16   8  

∴ The estimate of I is 1.0508 (correct to 4 d.p.)




1 4
Remark: The exact value of I   4
e cos xdx   e x (cos x  sin x) 
x
0
2 0
1 4    1
 e  cos  sin   e0 (cos 0  sin 0)
2  4 4 2
 1.050883197
4-22
Example 10

Let I =  sin x dx
2
0

(a) Estimate the value of I using 6 subintervals by


(i) Trapezoidal rule
(ii) Simpson’s rule
(b) Compare with their accuracy with true value of I.
Give all your answers in 4 decimal places.

Solution:

(a) (i) For n = 6



0

h= 2 =
6 12



       5  
I   sin xdx  T6  12  sin 0  sin   2  sin  sin  sin  sin  sin    0.994281888
2
0 2  2   12 6 4 3 12  

∴ The estimate of I is 0.9943 (correct to 4 d.p.)

(ii) For n = 6

0

h= 2 =
6 12



     5     
I   sin xdx  S6  12  sin 0  sin   4  sin  sin  sin   2  sin  sin    1.000026312
2
0 3  2   12 4 12   6 3 

∴ The estimate of I is 1.0000 (correct to 4 d.p.)

 
   
(b) The true value of I =  sin x dx =   cos x 02    cos       cos(0)   0  1  1
2
0
  2 

Simpson’s rule gives estimate of I more accurate than that of trapezoidal rule using the same even
number of subintervals.

4-23
Example 11

0 .5
Let I =  e  x dx. Find the least number of subintervals required to give the estimate of I correct to
2

4 decimal places by
(a) Trapezoidal rule (b) Simpson’s rule

Solution:

(a) Let f(x) = e x


2

We have f '(x)  2xe  x


2

f "(x)  2e  x  2x( 2xe  x )  e  x (4x 2  2)


2 2 2

f '''(x)  e  x (8x)  (4x 2  2)( 2xe  x )  12xe  x  8x 3e  x  4x(3  2x 2 )e  x  0 on [0, 0.5]


2 2 2 2 2

Since f "(x) is increasing and < 0 on [0, 0.5]

∴ M 2  max f "(x)  f "(0)  e 0 [4(0) 2  2]  2


2

0  x  0.5

(0.5  0) 2
(0.5  0)
n2 (0.5) 3 (2) 1
En =  f "(c)  = ( ∵ 0  c  0.5 )
12 12n 2
48n 2

1 1
Since the error tolerance is 104  5 105 , we set E n  2
 5 105 i.e. n 2  416.6667 ∴ n  20.41
2 48n

Hence the least number of subinterval required is 21 (round up to the nearest integer)

(b) f (4) (x)  12e  x  12x( 2xe  x )  8(3x 2 )e  x  8x 3 ( 2xe  x )  (16x 4  48x 2  12)e  x
2 2 2 2 2

f (5) (x)  (64x 3  96x)e  x  (16x 4  48x 2  12)(2xe  x )


2 2

 (32x 5  160x 3  120x)e  x


2

 8xe  x (4x 4  20x 2  15)


2

 8xe  x [(2x 2  5) 2  10]  0 on [0, 0.5]


2

Since f ( 4) (x) is decreasing and > 0 on [0, 0.5]

∴ M 4  max f (4) (x)  f (4) (0)  [16(0) 4  48(0)2  12]e (0)  12


2

0 x 0.5

(0.5  0) 4
(0.5  0)
n4 (0.5)5 (12) 1
En =  f ( 4 ) (c)  4
 ( ∵ 0  c  0.5 )
180 180n 480n 4

1 1
Since the error tolerance is 104  5 105 , we set E n  4
 5 105 i.e. n 4  41.6667 ∴ n  2.54
2 480n

Hence the least even number of subinterval required is 4 (round up to the nearest even integer)
4-24

You might also like