0% found this document useful (0 votes)
30 views18 pages

Topic 4 Numerical Method Edited Publish

The document discusses numerical methods for finding approximate solutions to equations that cannot be solved algebraically. It introduces the Newton-Raphson method, which uses tangent lines to iteratively find better approximations of roots. Given an initial guess, it uses the formula xn+1 = xn - f(xn)/f'(xn) to calculate subsequent approximations that converge on the root. The document provides examples of using this method to find roots of various equations to varying degrees of accuracy. It also discusses other numerical techniques like using graphs to estimate intersections and sign changes to locate roots.

Uploaded by

aqilmegat05
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)
30 views18 pages

Topic 4 Numerical Method Edited Publish

The document discusses numerical methods for finding approximate solutions to equations that cannot be solved algebraically. It introduces the Newton-Raphson method, which uses tangent lines to iteratively find better approximations of roots. Given an initial guess, it uses the formula xn+1 = xn - f(xn)/f'(xn) to calculate subsequent approximations that converge on the root. The document provides examples of using this method to find roots of various equations to varying degrees of accuracy. It also discusses other numerical techniques like using graphs to estimate intersections and sign changes to locate roots.

Uploaded by

aqilmegat05
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/ 18

Topic 4: Numerical Method

TOPIC 4: NUMERICAL METHOD

4.1 Solution of Non-Linear Equations

LEARNING OUTCOMES

At the end of the lecture, students should be able to:


• Locate approximately a root of an equation, by means of graphical
considerations and/or searching for a sign change.

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.

This method is used to locate an approximate root of an equation f ( x ) = 0 .

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

Hence, there is no solution for the


1 1
equation = − x or x + = 0 or
x x
x2 + 1 = 0 .

65
Topic 4: Numerical Method

4.1.1 Numerical Method

The equation f ( x ) = 0 has at least one real root between x = a and x = b if


f ( a ) and f ( b ) are opposite signs.

Example 4.1

Locate the roots of the equation 2 x 3 − 3 x 2 − 13 x + 9 = 0 .

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 .

Therefore, the roots of the equation 2 x 3 − 3 x 2 − 13 x + 9 = 0 lie between


x = −3 and x = −2 , between x = 0 and x = 1 and 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

Show that there is a root between −1 and 0 for the equation x 3 + x + 1 = 0 .

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

4.1.2 Graphical Method

A graphical method can be used to find an approximate value for the root of an
equation.

Consider the equation x 3 + x − 6 = 0 .

Since f ( x )  x3 + x − 6 cannot be factorized, the solution of this equation is not a


rational number.

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.

Alternatively, the equation x 3 + x − 6 = 0 may be written as x3 = 6 − x . Then it can be


solved by drawing the graphs y = x 3 and y = 6 − x on a single diagram; the solution is
obtained by reading the value of x where the graphs intersect.

Example 4.5

Find the approximate solution of the equation ln x + x − 4 = 0 by using the graphical


method.

SOLUTION

The equation ln x + x − 4 = 0 may be written as ln x = 4 − x.


The solution of this equation is given by the point of intersection of the graphs
y = ln x and y = 4 − x .

From the diagram, the intersection occurs at the point x  2.9

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

The equation x 4 + 2 x − 4 = 0 is equivalent to x 4 = 4 − 2 x . The roots of the equation


x 4 + 2 x − 4 = 0 are given by the x-coordinates of the points of intersection of the
graphs y = x 4 and y = 4 − 2 x . It is obvious from the adjacent diagram that these roots
lie between x = −2 and x = −1 , and also between x = 1 and x = 2 .

70
Topic 4: Numerical Method

Example 4.7

Use a graphical method to find an approximate root(s) to the following equations.


Give your answer correct to one decimal place.

a) e x = 3 x + 4 Ans: 2.4, − 1.2


b) x 3 − 2 x 2 = 4 Ans: 2.6

SOLUTION

71
Topic 4: Numerical Method

4.2 Newton-Raphson Method

LEARNING OUTCOMES

At the end of the lecture, students should be able to:


• Find the root by the Newton-Raphson method

The Newton-Raphson method is the method of using tangents to find a better


approximation to the root of an equation.

Consider the equation f ( x ) = 0 .


a) A solution to this equation is given by the point R where the graph y = f ( x )
cuts the x–axis (see Figure 4.3).
b) Assume that a is an approximation to the root of the equation, where A is near
R.
c) The point Q where the tangent to the curve at P meets the x–axis is nearer to
the point R.
d) Hence b is a better approximation to the root of the equation f ( x ) = 0
compared to a.

From Figure 4.3,


a) b = a − AQ
AP f ( a )
b) Gradient of the tangent at P = = = f '(a)
AQ AQ
f (a)
that is, AQ =
f '(a)
f (a)
by substitution, b=a−
f '(a)

c) With a as the first approximation, b is a better approximation (the second


approximation).

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.

Figure 4.5 shows the case where:


A = first approximation
B = second approximation is further away from point R.

73
Topic 4: Numerical Method
Method of Getting the First Approximate Value of an Equation f (x) = 0.

Method I: Graphical Method


Draw the curve y = f ( x ) on a piece of graph paper and just estimate the root from
the graph which is the first approximate value of the root to the equation f ( x ) = 0 .

Method II: Analytical Method


If a function f ( x ) changes sign between x = a and x = b, then the curve of y = f ( x )
must intersect the x–axis at a point x =  such that f ( ) = 0 , where a    b .

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

By writing the equation xe x = 1 as x = e − x , the first approximation to the root of this


equation may be determined by drawing the graphs of y = x and y = e − x .

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

f ( 0.5671) ( −0.0001196) = 0.5671


With x3 = 0.5671, x4 = 0.5671 − = 0.5671 −
f ' ( 0.5671) 2.7630

Hence, the root is 0.567 correct to three significant figures.

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

Hence, the root is 1.52, correct to two decimal places.

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

4.3 Trapezoidal Rule

LEARNING OUTCOMES

At the end of the lecture, students should be able to:


• Use the trapezoidal rule to approximate definite integrals.

b
If the value of the definite integral  f ( x ) dx
a
is required and the integral cannot be

integrated, methods of approximation can be used.

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

Using the trapezoidal rule,


8
2
 1 + x 2 dx  9.0623 + 2 (12.442 )   33.946
0
2

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

Using the trapezoidal rule,


8
dx 0.25
 1+ x  1.5 + 2 ( 2.3812 )   0.7828
0
2
2 

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

1. On the same axes, sketch y = e x − 2 and y = −2 x . Estimate the point of


intersection of the graphs. Hence, by using the Newton-Raphson method, find
the root correct to four decimal places.
Ans: 0.3149

2. a) By sketching the graph of y = 2 ( 2 x − 1) and y = x3 on the same axes,


show that there are three real roots of y = x 3 − 4 x + 2 .

b) By using the Newton-Raphson method and an initial value of 1.5,


determine the real root of y = x 3 − 4 x + 2 that lies between 1 and 2,
correct to three significant figures. Ans: 1.68

3. a) Show that the equation x − 5 + ln x = 0 has a root between 3 and 4.

b) By using the Newton-Raphson method and an initial value of 3.5,


determine the root correct to four significant figures.
Ans: 3.693

4. Show that the root of the equation 2e x + x 2 − 4 = 0 lies in the interval of


( 0.55, 0.65) . Hence, by using the Newton-Raphson, find the root correct to
three significant figures. Ans: 0.599

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

subintervals, correct to two decimal places.


Ans: 41.29

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

You might also like