Topic 4 Numerical Method Edited Publish
Topic 4 Numerical Method Edited Publish
LEARNING OUTCOMES
Some equations cannot be solved using algebraic methods to give an exact solution,
such as the solution of the equation x = sin x . For this case, we need to use numerical
methods to solve them.
Initially, we need to determine an interval in which the roots lie. Generally, if, f ( )
and f ( ) have opposite signs, then the equation f ( x ) = 0 has a root for some x
satisfying x . This method can only be applied if f ( x ) is a continuous
function in the interval ( , ) .
1
If f ( x ) is not continuous, for example f ( x ) = x + , x 0 ,
x
f ( −1) = −1 − 1 = −2 0
f (1) = 1 + 1 = 2 0
1 1
Therefore, the equation of x + = 0 can be written as = − x .
x x
1
When we sketch graphs of y = and
x
y = − x on the same coordinate axes, we
see that there is no intersection between
1
the curve y = and the line y = − x .
x
65
Topic 4: Numerical Method
Example 4.1
SOLUTION
Let f ( x ) = 2 x3 − 3x 2 − 13x + 9 .
Construct a table of values for x and f (x).
x -4 -3 -2 -1 0 1 2 3 4 5
f (x) -115 -33 7 17 9 -5 -13 -3 37 119
From the table, it can be seen that f ( x ) changes sign between x = −3 and x = −2 ,
between x = 0 and x = 1 also between x = 3 and x = 4 .
66
Topic 4: Numerical Method
Example 4.2
Use a numerical method to determine two consecutive integers between which the
roots of the following equations lie.
a) x 3 + x + 3 = 0 Ans: -2 and -1
b) x 2 + x − 37 = 0 Ams: 5 and 6
SOLUTION
Example 4.3
SOLUTION
Let f ( x ) = x3 + x + 1
We have f ( −1) = −1 − 1 + 1 = −1 0
f ( 0 ) = 0 + 0 + 1 = 1 0 lie
We know that f ( x ) is continuous for −1 x 0 (because it is a cubic function),
f ( −1) and f ( 0 ) are of opposite signs, hence there is a root between x = −1 and x = 0
for f ( x ) = 0 .
67
Topic 4: Numerical Method
Example 4.4
Show that the equation x3 − 3 x 2 − 4 x + 3 = 0 has three distinct real roots which lie
between −2 and − 1, 0 and 1, 3 and 4 respectively.
SOLUTION
68
Topic 4: Numerical Method
A graphical method can be used to find an approximate value for the root of an
equation.
The solution can be found by drawing the graph of y = x 3 + x − 6 and noting the value
(or values) of x where the curve cuts the x-axis. The solution obtained in this way is
just an approximation.
Example 4.5
SOLUTION
69
Topic 4: Numerical Method
Example 4.6
Show, using a graphical method, that the equation x 4 + 2 x − 4 = 0 has two real
solutions and that the solutions lie between x = −2 and x = −1 , and between
x = 1 and x = 2. .
SOLUTION
70
Topic 4: Numerical Method
Example 4.7
SOLUTION
71
Topic 4: Numerical Method
LEARNING OUTCOMES
72
Topic 4: Numerical Method
f (b)
d) This process may be repeated to obtain the third approximation c = b −
f ' (b)
and so on.
If x1 is the first approximation to the root of the equation f ( x ) = 0, then the second,
third, … approximations are written as x2 , x3 , ... and are given by the formula,
f ( xn )
xn +1 = xn −
f ' ( xn )
There are specific cases where the Newton-Raphson method does not give a better
approximation. A clear case occurs when f ' ( a ) is very small.
73
Topic 4: Numerical Method
Method of Getting the First Approximate Value of an Equation f (x) = 0.
That is,
• if f ( a ) 0 and f ( b ) 0 , then the equation f ( x) = 0 has a root
where a b .
• if f ( a ) 0 and f ( b ) 0 , then the equation f ( x) = 0 has a root
where a b .
Just choose x = x1 near to a or b for the first approximate value. By using the
Newton-Raphson Formula, we will obtain a sequence of values that will converge to a
constant value as required by the question.
Example 4.8
Use the Newton-Raphson method to find the root of the equation xe x = 1 correct to
three significant figures.
SOLUTION
74
Topic 4: Numerical Method
−x
From the diagram, it can be seen that e = x when x 0.6 . This value is taken as the
first approximation to the root of the equation xe x = 1 .
Let f ( x ) = xe x − 1.
Then, f ' ( x ) = e x + xe x = e x ( x + 1) .
If x1 is the first approximation, then a better approximation is
f ( x1 )
x2 = x1 −
f ' ( x1 )
f ( 0.6 ) 0.09327
With x1 = 0.6, x2 = 0.6 − = 0.6 − = 0.5680
f ' ( 0.6 ) 2.9154
f ( 0.5680 ) 0.002369
With x2 = 0.568, x3 = 0.5680 − = 0.5680 − = 0.5671
f ' ( 0.5680 ) 2.7671
Example 4.9
Prove that the equation has one real root between 1 and 2. By taking 1 as the first
approximation, find this root correct to two decimal places.
SOLUTION
Let f ( x ) = x3 + x − 5
f (1) = 13 + 1 − 5 = −3
f ( 2 ) = 23 + 2 − 5 = 5
Since f (1) and f ( 2 ) are opposite signs, there is a root between x = 1 and x = 2 .
f ' ( x ) = 3x 2 + 1
Using the Newton-Raphson method with x1 = 1 , a better approximation is
f ( x1 ) f (1)
x2 = x1 − = 1−
f ' ( x1 ) f ' (1)
= 1−
( −3)
4
= 1.750
75
Topic 4: Numerical Method
f (1.750 )
With x2 = 1.750 , x3 = 1.750 −
f ' (1.750 )
2.1094
= 1.750 −
10.1875
=1.543
f (1.543)
With x3 = 1.543 , x4 = 1.543 −
f ' (1.543)
0.2167
= 1.543 −
8.1425
=1.516
f (1.516 )
With x4 = 1.516 , x5 = 1.516 −
f ' (1.516 )
0.0002
= 1.516 −
7.8948
=1.516
76
Topic 4: Numerical Method
Example 4.10
Show that the equation e x = 4sin x has a root between x = 1 and x = 2 , and find this
root correct to three significant figures using the Newton-Raphson method.
SOLUTION
77
Topic 4: Numerical Method
LEARNING OUTCOMES
b
If the value of the definite integral f ( x ) dx
a
is required and the integral cannot be
b
Since f ( x ) dx measures the area bounded by the curve y = f ( x ) , the x – axis, and
a
the lines x = a and x = b, one method is to draw the curve on graph paper and
estimate the area by counting the squares enclosed. However, it is simpler to obtain an
estimate of this area by the trapezoidal rule, which is to express the required area
approximately as the sum of a series of trapeziums.
The area is divided into a number of parallel strips, each of width h. Let the
ordinates of the curve at successive points be y0 , y1 , y2 , ..., yn −1 , yn .
78
Topic 4: Numerical Method
The trapezoidal rule estimates the area under the curve as:
y0 + y1 y + y2 y + y3 y +y
h +h 1 +h 2 + ... + h n −1 n
2 2 2 2
1 1
h y0 + y1 + y2 + ... + yn −1 + yn
2 2
1
h ( y0 + yn ) + ( y1 + y2 + ... + yn −1 )
2
h
y0 + yn + 2 ( y1 + y2 + ... + yn −1 )
2
h
Sum of the areas of trapeziums y0 + yn + 2 ( y1 + y2 + ... + yn −1 )
2
b−a
where h =
n
a = lower limit
b = upper limit
n = number of subintervals
Example 4.11
8
Use the trapezoidal rule with 4 subintervals to estimate 0
1 + x 2 dx .
SOLUTION
x y = 1 + x2
0 1
2 2.2361
4 4.1231
6 6.0828
8 8.0623
9.0623 12.442
8−0
h= =2
4
79
Topic 4: Numerical Method
Example 4.12
1
1
Use the trapezoidal rule with 5 ordinates to find an approximation to 1+ x
0
2
dx .
SOLUTION
x 1
y=
1 + x2
0 1
0.25 0.9412
0.50 0.8000
0.75 0.6400
1 0.5
1.5 2.3812
1− 0
h= = 0.25
4
Example 4.13
Use the trapezoidal rule to obtain approximate values of the following integrals.
4
e
x
a) dx by using 3 ordinates. Ans: 70.38
0
1
1
b) 1+ x
0
dx by dividing the range into 4 equal parts. Ans: 0.697
1
c)
0
cos x dx by taking ordinates at intervals of 0.25. Ans: 0.911
80
Topic 4: Numerical Method
TUTORIAL 4
5. The region bounded by the curve y = sin x and y = cos x for x = 0 and
x= is denoted by A. Use the trapezoidal rule with four subintervals to
4
estimate the area A, giving your answer correct to two decimal places.
Ans: 0.41
2
2e
x2
6. Estimate the value of dx by using the trapezoidal rule with 4
0
81
Topic 4: Numerical Method
7. Use the trapezoidal rule with five strips to find an approximate value for
4
1
1 x + x2 dx . Express your answer correct to four decimal places.
Ans: 0.4910
4
ln x3
8. Evaluate an approximate value for 2 x dx by using the trapezoidal rule
4
ln x3
with six ordinates. Hence, find the value of 2 x dx correct to three
decimal places.
Ans: 2.158, 1.079
2
9. Use the trapezoidal rule to estimate g ( x ) dx from the data given below:
0
x 0 0.5 1 1.5 2
g (x) 0 0.4122 2.7183 10.0838 29.5562
Ans: 13.9962
82