Sie sind auf Seite 1von 25

Applied Numerical Methods For Engineers Roots of a Function 2-1

2.0 ROOTS OF A FUNCTION


“A loss is not always undesirable,... but it may be a test of quality ”- zar97

Scope and Preview:

There are two classes of numerical methods to determine the roots of the equation.

A. Bracketing Methods. Bisection and false-position techniques will be discussed. We


start with two initial guesses that bracket (or contain) the root and then systematically
reduce the width of the bracket. The methods always converge. We will also formulate the
errors to make sure that the estimate of the root falls within the prespecified level of
accuracy.

B. Open Methods - one-point iteration, Newton-Raphson, and secant methods will be


covered. They involve systematic trial-and-error iterations but no need for the initial
guesses to bracket the root. Usually more efficient but not always work.

In this section, we are trying to determine solutions (or roots) of a function using
numerical methods. A function may be of a single independent variable or multi-
independent variables.

f(x) = ax2 + bx + c (2.1)

f(x, y) = ax2 + bxy + cy2 + d (2.2)

Finding the roots of the equations means that we want to solve for the values of x or both x
and y of the above equations when they are equal to zero.

f(x) = 0
f(x, y) = 0.

Note: Roots of equations may either real or complex.

1
Roots of a Function Applied Numerical Methods For Engineers 2-2

2.1 Graphical Methods

This is a simple method to get an estimate of the root of the equation f(x) = 0. The function
f(x) is plotted against x and the location(s) where it crosses the x axis (i.e. f(x) = 0)
provides a rough approximation of the root(s).

Spreadsheet and other computational tools such as Lotus 1-2-3, MATLAB, MathCAD,
DERIVE, and etc may used for this purpose. Figure 2.2-1 shows a MATLAB program that
plots the function f(x) = x2 - 4x- 3 for a given range of x from 0 to 8.

%
% MATLAB Program 2.1-1: Plotting Graph
%
x = 0:0.1:8;
y = x.^2 - 4*x - 3;
plot(x,y); xlabel(‘x’); ylabel(‘f(x)’);

20
15
10
f(x)

5
0
-5
-10
0 1 2 3 4 5 6 7 8
x

Figure 2.1-1: Plot of a function

From the graph, the root is approximately equal to 4.6.

Remark: 1. Graphical method only provides rough estimates of the roots ( i.e. not
accurate).
2. These estimates can be used as initial guesses for advanced numerical
methods.

2
Applied Numerical Methods For Engineers Roots of a Function 2-3

2.2 BRACKETING METHODS

General guides (with few exceptions):

Let xu be an upper bound of the interval => f(xu )


xl be a lower bound of the interval => f(xl )

1. If f(xu ) and f(xl ) has opposite signs, there is an odd number of roots in the interval.
2. If f(xu ) and f(xl ) has same signs, there is either no root or an even number of roots.

Figure 2.2-1 shows the graphical depiction of these situations.

f ( x) f ( x)

three roots

xl xl
x
xu x xu

(a) odd root (b) odd roots

f ( x) f ( x)

no root two roots

x
xl xu x xl xu

(c) no root (d) even roots

3
Roots of a Function Applied Numerical Methods For Engineers 2-4

Exceptions to these general rules:

(i) when the functions are tangential to the x axis such as f(x) = (x - 3)(x - 2)(x - 2)
= 0 as shown in figure 2.2-2(a) and

(ii) when the functions are discontinuous. as shown in figure 2.2-2(b)

For the function f(x) = (x - 5)(x - 5)(x - 1) = 0, the root x = 5 is called the multiple root.
The procedures for a function with multiple roots will be discussed in section 2.4.

Figure 2.2-2 shows the graphical depiction of these two exceptions.

f(x) double roots


f ( x) Point of
discontinuity

xl
x xl
xu x
xu

(a) multiple root b) discontinuity

Figure 2.2-2: Exceptions to the general rules for bracketing methods

4
Applied Numerical Methods For Engineers Roots of a Function 2-5

a Bisection Method

From the graphical method, we found that when a function f(x) is continuous and real in the
interval from xl to xu , and f(xl ) and f(xu ) have opposite signs, that is

f ( xl ) f ( xu )  0 (2.2-1)

then there is at least one real root between xl and xu.

Steps:
1. Guess or select an interval [xl, xu] that contains the
root: f(xl )f(xu ) < o.
f(x) xl  xu
2. Estimate the root xr: xr  (2.2-2)
real root
2
3. Evaluate the products :

xl if f(xl )f(xr ) < 0 , set xu = xr.


xr xu x if f(xr )f(xu ) < 0 , set xl = xr.
if f(xl )f(xr ) or f(xr )f(xu ) = 0 , xr = root. Stop !!!
Figure 2.2-3: Bisection method
4. Check for convergence:
if satisfies prespecified tolerance s , stop !!!
else Repeat Step 2.

Convergence Criterion. Since the process of finding the roots of the equation is
iterative, it is important to specify a convergence criterion s ( or a tolerance) in order to
terminate the iterations.

xrk 1  xrk
a  100% (2.2-3)
xrk 1
where
xrk 1  xrnew and xrk  xrold

When a < s , stop the procedures.

Example 2.2-1: Using Bisection method to find the root of the equation.

Problem Statement: Find the root of the 3rd-order polynomial

f(x) = x3 - x2 - 10x - 8 = 0

in the interval [3.75, 5]. The tolerance s is 0.5%.

Solution: Analytical solution yields x = 4.0 (true root)

5
Roots of a Function Applied Numerical Methods For Engineers 2-6

iteration xl xr xu f(xl ) f(xr ) f(xu ) a % t %


k
1 3.750 4.375 5.000 -6.830 12.850 42.000 - 9.375
2 3.750 4.062 4.375 -6.830 1.903 12.850 1.550
3 3.750 3.906 4.062 -6.830 -2.724 1.903 2.350
4 4.062 -2.724 -0.477 1.903 1.96 0.400
5 4.023 -0.477 0.696 1.903 0.97 0.575
6 4.004 -0.477 0.120 0.696 0.49 0.100

We stop the iteration since a is less than s .

Therefore, the root is x = 4.004 which is pretty close to the true value of 4.0.

Note: a is always greater than t for the bisection method.

xu  xl
Remark: 1. After n steps of bisection, the interval will have the size of .
2n
2. The method will always converge on the root, provided that only one
root lies in the interval.

3. Rate of convergence is relatively slow.

Example of MATLAB code for Bisection Method


clear all
F = inline('x^3 - x^2 - 10*x - 8'); %Define a function using inline BIF.
xl = 3.75; xu = 5; imax = 20; es = 0.5;
xr = 0; % Dummy value for xr.
Fl=F(xl); Fu=F(xu);
if Fl*Fu > 0
disp('Error: The function has the same sign at points xl and xu.')
else
disp('iteration xl xu Solution(xr) f(xr) ea')
for i = 1:imax
xrold = xr;
xr = (xl + xu)/2;
Fr=F(xr);
ea=abs((xr-xrold)/xr)*100;
fprintf('%3i %11.4f %11.4f %11.4f %11.4f %8.4f\n',i, xl, xu, xr, Fr, ea)
if Fr == 0
fprintf('An exact solution x =%11.6f was found',xr)
break
end
if ea < es
break
end
if i == imax
fprintf('Solution was not obtained in %i iterations',imax)
break
end
if Fl*Fr < 0
xu = xr;
else
xl = xr;
Fl = Fr;
end
end
fprintf('The approximate solution is x = %11.6f \n ',xr)
end

6
Applied Numerical Methods For Engineers Roots of a Function 2-7

MATLAB Results:
>>
iteration xl xu Solution(xr) f(xr) ea
1 3.7500 5.0000 4.3750 12.8496 100.0000
2 3.7500 4.3750 4.0625 1.9182 7.6923
3 3.7500 4.0625 3.9063 -2.7166 4.0000
4 3.9063 4.0625 3.9844 -0.4661 1.9608
5 3.9844 4.0625 4.0234 0.7092 0.9709
6 3.9844 4.0234 4.0039 0.1174 0.4878
The approximate solution is x = 4.003906
>>

b False-Position Method

Unlike the bisection method, the false-position method takes into account the magnitudes
of the function at the lower and upper bounds, f(xl ) and f(xu ). For example, if f(xl ) is
closer to zero than f(xu ) then xl is likely to be closer to the root xr than xu is. This results
in an improved estimate of the root. It is also called linear interpolation method.

A straight line is drawn connecting points (xl, f(xl ))


f(x) and (xu, f(xu )). Clearly, xl is closer to xr. Thus,
using similar triangle we can write,

f ( xl ) f ( xu )

xr xr  xl xr  xu
xl xu x

Solving for xr yields


Figure 2.2-4: False-position method
( xi  xu )
xr  xu  f ( xu ) (2.2-4)
f ( xl )  f ( xu )

Compute xr, and replace it with whichever of the initial guesses, xl or xu , that has a
function of the same sign as f(xr ). In this way the interval [xl , xu ] always bracket the true
root. The process is repeated until the root converge.

The steps for this method are similar to that of the bisection method with eq.(2.2-4)
replacing eq.(2.2-2) in Step 2. The stopping criterion is also the same as before.

7
Roots of a Function Applied Numerical Methods For Engineers 2-8

Example 2.2-2: Using false-position method to find the root of the equation.

Problem Statement: Using the false-position method, find the root of the 3rd-order
polynomial
f(x) = x3 - x2 - 10x - 8 = 0

in the interval [3.75, 5]. The tolerance s is 0.5%.

Solution: Analytical solution yields x = 4.0. (true root)

iteration xl xr xu f(xl ) f(xr ) f(xu ) a % t %


i
1 3.750 3.925 5.000 -6.830 -2.193 42.000 - 1.875
2 3.925 3.978 5.000 -2.193 -0.645 42.000 1.332 0.550
3 3.978 3.993 5.000 -0.645 -0.196 42.000 0.376 0.175
4 3.993 3.998 5.000 -0.196 -0.070 42.000 0.125 0.050
5
6
7

In this example, we need only 3 iterations as compared to 6 iterations for the bisection
method.

In general, the false-position method converges faster than the bisection and that a is
not always greater than t for this method.

Remark: There are cases when the bisection is a better approach than the false-
position method.

8
Applied Numerical Methods For Engineers Roots of a Function 2-9

Worksheet 2.2-1: Using bisection and false-position method to find the root.

Problem Statement: Use both the bisection and false-position method to find the root of
the function
f(x) = x4 - 2 = 0

in the interval [0, 2] until the absolute error is 0.01.

Solution: Analytical solution yields x = 1.1892 (with 4 d.ps accuracy).

Bisection method:
iteration xl xr xu f(xl ) f(xr ) f(xu ) Et
i
1
2
3
4
5
6
7
8

Comments:

False-position method:
iteration xl xr xu f(xl ) f(xr ) f(xu ) Et
i

Comments:

9
Roots of a Function Applied Numerical Methods For Engineers 2-10

False-position method ( or regulae falsi) has two disadvantages:

1. It is not always the case that xr is better estimate than the mid-point. There are cases
when the size of the interval decreases slowly than in the bisection method. (Refer
example 4.7, p.141 of the textbook).

2. The size of the interval containing the root doesn’t, in general, approach zero. This is
because, in the neighborhood of the root, most functions are strictly concave or convex
and this results in only one of the end-points approaching the root while the other remains
fixed. Consequently, the size of the interval is of little use as a bound on the error in the
approximation or as a tolerance for terminating the iterations.

General remarks about the bracketing methods:

1. Besides checking an individual answer, it is important to determine locations of all


possible roots. A plot of the function is usually very helpful in this.

2. Use an incremental search at the beginning of the computer programs. Starting at one
end of the region of interest and then making function evaluations at small increments
across the region. Note where the change of sign occurs. Use the bound as an initial
guess of the interval. However, it can very time-consuming if the interval is too small. On
the other hand, if the interval is too large - some closely spaced roots might be missed.

3. Experience and understanding of the problem background might help in locating all the
roots of the functions.

f(x)
x

xl x
xu

Figure 2.2-5: Incremental search for a specific bound.

10
Applied Numerical Methods For Engineers Roots of a Function 2-11

2.3 OPEN METHODS


“Life is a continuous search of excellence, until we are firmed in the truth.’-zar97

Open methods are based on a single starting point or two points that do not have to
bracket a root. Some of them require an evaluation of the first derivative of the functions.
Sometimes, the open methods diverge from the root. But when they do converge, they do
so more quickly than the bracketing methods.

a One-point iteration method (or fixed-point iteration)

This is done by rearranging the function f(x) = 0 so that x is on the left side of the
equation,

x = g(x) (2.3-1)

This can be accomplished by

(i) algebraic manipulation of the function f(x)


(ii) simply adding a variable x to both side of the function.

For example,

f(x) = x3 + x2 + x - 4 = 0 => x = 4 - x2 - x3 or x  4  x  x 3

f(x) = ln(x) = 0 => x = ln(x) + x


2x
f ( x)  =0
1  x  x2

f ( x )  1  x  xe x = 0

Eq.(2.3-1) gives us a formula to predict the value of x as a function of x i.e. it can be used
to estimate the new value xi+1 knowing or having an initial guess xi (an old value).

xi+1 = g(xi ) (2.3-2)

11
Roots of a Function Applied Numerical Methods For Engineers 2-12

The convergence criterion for this method is given by

xi 1  xi
a  100% < s (2.3-3)
xi 1
This formula has a linear convergence. Figure 2.3-1 shows graphical depiction of the
procedures.
f(x)
root

x
xi

Figure 2.3-1: One-point iteration method.

Remark: The method does not work when

g' ( xi )  1 at all points in the interval [a, b]. It diverges


from xr either in staircase or in oscillation.
The method is applicable only when
g' ( xi )  1 at all points in the interval [a, b]

How to overcome? 1. Choose different initial guess.


2. Modify the function g(x) into another form.
3. Choose another method.

f(x) f(x)

x xi x
xi
(a) oscillation divergence (b) staircase divergence

Figure 2.3-2: Divergence for one-point iteration method

12
Applied Numerical Methods For Engineers Roots of a Function 2-13

One-point iteration method to determine the root.

Example 2.3-1: Use the one-point iteration method to find the root of the function

x
f ( x)  e 4 (2  x)  1  0

with initial guess x = 0 until the approximate percent relative error is less than 0.1%.

Solution: x
Rearranging f(x): x  2  e4
xk
or x k 1  2  e 4
0
For k = 0 x0 = 0, x1  2  e 4 = 2 - 1 = 1

Repeat the above procedure for k = 1, 2, 3, ...

iteration xk xk+1 a %
k
0 0 1 100
1 1 0.715975 39.66
2 0.715975 0.803987 10.94
3 0.803987 0.777379 3.42
4 0.777379 0.785485 1.03
5 0.785485 0.783021 0.31
6 0.783021 0.783771 0.09

Since a is less than 0.1%, we stop the iteration. The root is 0.783771.

Check: f(0.783771) = 0.0001876  0.

13
Roots of a Function Applied Numerical Methods For Engineers 2-14

One-point iteration method to determine the root.

Worksheet 2.3-1: Use the one-point iteration method to find the root of the function

f ( x )  0.5x 3  3x 2  0.5x  3  0

with initial guess (i) x = 0 and (ii) x = 5.0 with an accuracy to 2 d.ps.

Solution: 3
Rearranging f(x): (a) x  x 3  6x 2  6 (b) x 
0.5  3x  0.5x 2
(i) Using the form as in (a) for k = 0, 1, 2, 3, ...
iteration xk xk+1 a %
k
0 0 6
1 6 6
2 6 6

Using the form as in (b) for k = 0, 1, 2, 3, ...


iteration xk xk+1 a %
k
0 0 6
1 6 6
2 6 6

(ii) Using the form as in (a) for k = 0, 1, 2, 3, ...


iteration xk xk+1 a %
k
0 5 -19
1 -19 -9019
2 -9019 -7.341(1011)

Using the form as in (b) for k = 0, 1, 2, 3, ...


iteration xk xk+1 a %
k
0 5 1
1 1 1
2 1 1

Comments:

14
Applied Numerical Methods For Engineers Roots of a Function 2-15

One-point iteration method to determine the root.

Worksheet 2.3-2: Use the one-point iteration method to find the root of the function

ex
f ( x)   x 2  120  0 (x=6.372153)
1 x

with initial guess (i) x = 0 and (ii) x = 6.0 with an accuracy to 2 d.ps.

Solution: ex
Rearranging f(x): (a) x  120 
(1  x )
1 x
or (b) x  [e  x 2 (1  x )  120]
120

e0
(a) For k = 0 (i) x0 = 0, x1  120  = 10.90871
(1  0)
Repeat the above procedure for k = 1, 2,
iteration xk xk+1 a %
k
0 0 10.90871 100
1 10.90871 -6.32311E24 100
2 -6.32311E24 -6.32311E24 0
???

1 0
(ii) x0 = 0, x1  [e  (0) 2 (1  0)  120] = -0.99167
120

Repeat the above procedure for k = 1, 2,


iteration xk xk+1 a %
k
0 0 -0.99167 100
1 -0.99167 -0.99684 0.519
2 ??? 0

Note: The one-point iteration method is not applicable to this function. Therefore,
alternative methods must be employed.

15
Roots of a Function Applied Numerical Methods For Engineers 2-16

b Newton-Raphson Method

This is the most widely used technique to find the root of the equations. It is an efficient
method if the first derivative of the function f’(x) is available or easy to get. From the
TSE (after truncating terms beyond the first derivative term), it can be shown that the
value of xi+1 in terms of xi is given as

f ( xi )
Newton-Raphson formula: xi 1  xi  (2.3-4)
f '( xi )

Steps: 1. Given f(x), f’(x), and initial estimate x0.


2. Evaluate the root xi+1, using eq.(2.3-4) with i = 0,1,2,3,...
3. Repeat Step 2 until converged.

Note that this method requires the evaluation of the function and its first derivative at an
old point xi which sometimes can be very difficult. Figure 2.3-3 illustrates the Newton-
Raphson method.

f(x)

root

x
xi xi+1

Figure 2.3-3: Graphical depiction of the Newton-Raphson method

16
Applied Numerical Methods For Engineers Roots of a Function 2-17

It can also be shown that the true error expression, Et, for the truncated TSE, in the form

 f ''( xi ) 2
E t ,i  1  E t ,i (2.3-5)
2 f '( xi )

which shows that the error is proportional to the square of the previous error. This type of
error behavior is called quadratic convergence i.e. the convergence is quadratic or
second-order.

Example 2.3-2: Newton-Raphson method to find the root of the equation .

Problem Statement: Use the Newton-Raphson method to find the root of the function

x
f ( x)  e 4 (2  x)  1  0

until the approximation error is less than 0.1%. Use x = 0 as initial guess.

Solution:
x
4 
x2 
First derivative: f '( x )  e   1
 4 

iteration
i xi f(xi ) f’(xi ) xi+1 a %
0 0.0 1.0 -1.5 0.666667 -
1 0.666667 0.128642 -1.128642 0.780646 14.600
2 0.780646 0.003164 -1.073493 0.783594 0.376
3 0.783594 0.000002 -1.072096 0.783596 0.0002

17
Roots of a Function Applied Numerical Methods For Engineers 2-18

Remark:
1. If the function f(x) is linear, eq.(2.3-4) provides an exact solution on the
first trial; however, if f(x) is nonlinear, the formula is valid only over small
ranges of x.

2. When multiple roots occur, the convergence drops to first order.

3. The method can be used to determine complex roots of the real or


complex functions.

Disadvantages:

1. Some function are very difficult to differentiate analytically and the


method will not work if a zero or near zero slope is encountered. Thus,
the secant method would be a better alternative.

2. The root may diverge if there is an inflection point in the neighborhood


of the root.

3. The method will oscillate if local minima or maxima in f(x) present in


the neighborhood of the root.

18
Applied Numerical Methods For Engineers Roots of a Function 2-19

c Secant Method

Secant method is very useful when f’(x) is either unavailable or costly to evaluate. It
requires two initial approximations which don’t have to bracket the root. The estimate of
the root, xi+1 , is given in terms of xi and xi-1 as

( xi 1  xi )
Secant formula: xi 1  xi  f ( xi ) (2.3-6)
f ( xi 1 )  f ( xi )

Note: a secant to a curve is the straight line passing through two points on the curve. This
formula is similar to the false-position method but the interval does not have to bracket a
root. Thus, this method may diverge.

f(x)

secant line: connecting two points on the curve

root

x
xi-1 xi xi+1

Figure 2.3-4: Graphical depiction of the secant method.

The error expression, Et, as given by Jeeve (1958) is expressed as

1.62....
 f ''( xi ) 
Et ,i 1    Et1,.i62... (2.3-7)
 2 f '( xi ) 

which shows that the error is proportional to the power of 1.62... of the previous error
which is slightly less than the Newton-Raphson method.

19
Roots of a Function Applied Numerical Methods For Engineers 2-20

Example 2.3-3: Secant method to find the root of the equation.

Problem Statement: Use the secant method to find the root of the function

x
f ( x)  e 4 (2  x)  1  0

until the relative error is less than 0.1%. Use x = 0 and x = 1.0 as initial guesses.

Solution:

iteratio
n xi-1 xi f(xi-1) f(xi) xi+1 a %
i
1 0 1.0 1.0 -0.221199 0.818867 -
2 1.0 0.818867 -0.221199 -0.037521 0.781866 4.73
3 0.818867 0.781866 -0.037521 0.001855 0.783609 0.22
4 0.781866 0.783609 0.001855 0.000014 0.783596 0.0016

Remark: 1. If the function f(x) is linear, eq.(2.3-6) provides an exact solution on the
first trial; however, if f(x) is nonlinear, the formula is valid only over small
ranges of x.

2. When multiple roots occur, the convergence drops to first order.

General rule of thumb:

When the occasion arises that you have to choose between the Newton-Raphson
method and the secant method, the following rule is provided by Jeeves (1958):

If the effort required to evaluate f’(x) is less than 43% of the effort required to evaluate
f(x), then Newton-Raphson method is more efficient, otherwise, choose the secant
method.

20
Applied Numerical Methods For Engineers Roots of a Function 2-21

2.4 Multiple Roots

A multiple root corresponds to a point where a function is tangent to the x axis at that
point. For example, the following polynomials have, respectively, double and triple roots,

Double root: f(x) = x3 - 5x2 + 7x - 3 = (x - 3)(x - 1)(x - 1) at x = 1.

Triple root: f(x) = x4 - 6x3 + 12x2 - 10x + 3 = (x - 3)(x - 1)3 at x = 1.

Remark: In general, a function with odd multiple roots crosses the x axis, whereas,
a function with even multiple roots do not cross the x axis.

Figures 2.4-1(a) through (d) show several cases of multiple roots.

f(x) f(x)

x
1 2 3

x -3
xl c xu
(a) double root (b) double root

6 6

4 4

2 2

0 0

-2 -2

-4
-4
0 1 2 3 4 0 1 2 3 4

(c) triple root (d) quadruple root

Figure 2.4-1: Graphical depiction of multiple roots

21
Roots of a Function Applied Numerical Methods For Engineers 2-22

Consequently, multiple roots pose several limitations for the numerical methods
discussed early. There are two possible difficulties:

1. For a function with even multiple roots, the function does not change
sign over the interval. Thus, it eliminates the use of the reliable
bracketing methods.

2. At the multiple roots, both f(x) and f’(x) are zero or approach zero. This
poses problems for both Newton-Raphson and secant methods.

To overcome these two problems, a modified Newton-Raphson method is used.

a Modified Newton-Raphson Method

The potential problem with the methods discussed earlier is that when there exists
multiple roots. For example, if the number of roots at a point is even, the function does
not change sign at the root. In this case, the bracketing method is inapplicable.

In addition, the value of the function and its first derivative is also zero at the root. This
would make Newton-Raphson and secant method impossible. To overcome these
problems, a modified Newton-Raphson method is introduced. This method is based on
the fact that f(x) will always reach zero before f’(x).

Introducing the new function g(x) as the ratio of the function and its first derivative as

f ( x)
g( x)  (2.4-1)
f '( x )
Using quotient rule for the derivative,

[ f '( x )]2  f ( x ) f ''( x )


g '( x )  (2.4-2)
[ f '( x )]2

The modified Newton-Raphson method in terms of g(x) is then

g( x)
xi 1  xi  (2.4-3)
g '( x )

22
Applied Numerical Methods For Engineers Roots of a Function 2-23

Substituting eqs.(2.4-1) and (2.4-2) into eq.(2.4-3) yields

f ( xi ) f '( xi )
Modified Newton-Raphson formula: xi 1  xi  (2.4-4)
[ f '( xi )]2  f ( xi ) f ''( xi )

Note that in eq.(2.4-4), the denominator will not be zero even if f’(x) is zero. Therefore,
the formula is said to be more stable.

Remark: 1. The convergence for the modified Newton-Raphson method is quadratic


or 2nd-order.

2. Unless necessary, this method is seldom used in practice due more


computational effort involved.

Example 2.4-1: Modified Newton-Raphson method to find the root of the equation.

Problem Statement: Use the modified Newton-Raphson method to find the root of the
following polynomial function
f(x) = x3 - 7x2 + 8x +16 = 0

until the relative error is less than 0.05%. Use (i) x = 0 and (ii) x = 2.0 as initial guess.

Solution: Take the derivatives,


f’(x) = 3x2 -14x + 8
and f’’(x) = 6x -14

Plot of the function using Lotus 1-2-3:


30

20

10

-1 0

-2 0
-2 -1 0 1 2 3 4 5 6

The plot indicates that the roots are -1 and 4.

23
Roots of a Function Applied Numerical Methods For Engineers 2-24

(i) with initial guess xi = 0 and using eq.(2.4-1),

iteration
i xi f(xi ) f’(xi) f’’(xi) xi+1 a %
1 0.0 16.0 8.0 -14.0 -0.444444 -
2 -0.444441 0.9739371 14.81476 -16.666667 -0.848485 47.619
3 -0.848485 3.5617892 22.03857 -19.090909 -0.990253 14.316
4 -0.990253 0.2427162 24.80534 -19.941520 -0.999962 0.970
5 -0.999962 0.0009502 24.99924 -19.999772 -1.000000 0.004

Note: f’(x) does not approach zero, so x = 1.0 is not a multiple root.

(ii) initial guess xi = 2.0

iteration
i xi f(xi ) f’(xi) f’’(xi) xi+1 a %
1 2.0 12.0 -8.0 -2.0 3.090909 -
2 3.090909 3.380917 -6.611570 4.545455 3.879518 20.327
3 3.879518 0.070831 -1.161272 9.277108 3.998476 2.975
4 3.998476 0.000012 -0.015230 9.990858 3.999999 0.038

Note: f’(x) approaches zero, so x = 3.999999 (essentially 4.0) is a multiple root.


Furthermore. from the graph, we observe that the function only crosses the x axes twice.
Therefore, we conclude that x = 4 is double roots.

24
Applied Numerical Methods For Engineers Roots of a Function 2-25

Worksheet 2.4-1: Modified Newton-Raphson method to find the root of the equation .

Problem Statement: Use the modified Newton-Raphson method to find the root of the
following polynomial function
f(x) = 0.2x3 - x2 + 1.4x +0.6 = 0

until the relative error is less than 0.05%. Use (i) x = 0 and (ii) x = 5.0 as initial guess.

Solution: f’(x) = 0.6x2 - 2x + 1.4


f’’(x) = 1.2x - 2

(i) initial guess xi = 0


iteration
i xi f(xi ) f’(xi) f’’(xi) xi+1 a %

Comment:

(ii) initial guess xi = 5.0


iteration
i xi f(xi ) f’(xi) f’’(xi) xi+1 a %
-

Comment:

25

Das könnte Ihnen auch gefallen