Professional Documents
Culture Documents
b
2
4ac
2a
to solve
f(x) = ax
2
+ bx + c = 0,
where a, b and c are constants. The values obtained with the above quadratic formula
are called the roots, or solutions, of the function f(x). They represent the values of x
(denoted by a variable r in this document) that make f(x) equal to zero. Thus, we can
dene the root of an equation as the value of x that makes f(r) = 0. For this reason,
roots are sometimes called the zeros of the equation. If f(r) = 0 and f
(r) = 0, then
r is a simple root. For example, for f(x) = x
2
1, the simple roots are x = 1, since
f(1) = 0, f
(x) = 2x and f
)
ln 2
1.
Note that the number of iterations is independent of the function f(x).
EXAMPLE
How many iterations of the bisection method are required to nd the solution of
x 1 e
x
= 0 to six decimal places if the initial interval [1, 1.5] is used ?
solution:
A tolerance of = 5 10
7
(or smaller) is required to ensure six decimal places
accuracy. Here, a
0
= 1 and b
0
= 1.5, then
n
ln
(
1.51
510
7
)
ln 2
1 18.9 .
At least 19 iterations are required.
Lecture Notes MATH2114 Numerical Methods and Statistics for Engineers 7
3 Fixed Point Iteration Method
Suppose that x = g(x) is a rearrangement of f(x) = 0. Then, f(r) = 0 implies that
r = g(r), and the root r is called a xed point of the function g(x). A xed point can
sometimes be found using the xed point iteration method (also known as simple iteration,
method of successive substitution and one-point iteration),
x
n+1
= g(x
n
) for n = 0, 1, 2, . . . ,
given an initial estimate x
0
of the root r . The above relation provides a formula to predict
a new value of x as a function of an old value of x. Examples of convergent and divergent
iteration are shown below:
X
Y
g(x
0
)=x
1
g(x
1
)=x
2
x
2
x
1
x
0
y = g(x)
y = x
r
Convergent fixed point iteration
Y
r
x
0
x
2
x
1
Divergent fixed point iteration
g(x
0
) = x
1
g(x
1
) = x
2
y = g(x)
y = x
X
8 Solution of Nonlinear Equations
3.1 Convergence Criterion
Recalling that the error represents the dierence between the true value and approximate
(estimate) value. If r represents the exact root of f(x) and x
n+1
represents the most
recent estimate of r, then the error of x
n+1
is
e
n+1
= r x
n+1
.
Since r = g(r) amd x
n+1
= g(x
n
), we have
e
n+1
= r x
n+1
= g(r) g(x
n
)
= g
(
n
)(r x
n
) for
n
(r, x
n
) (by Mean Value Theorem)
= g
(
n
) e
n
.
Suppose that |g
(
n
) e
n
(
n
)
e
n
K|e
n
| if |e
n
| <
K
(
K|e
n1
|
)
= K
2
|e
n1
| if |e
n1
| <
K
2
(
K|e
n2
|
)
= K
3
|e
n2
| if |e
n2
| <
.
.
.
.
.
.
.
.
.
K
n+1
|e
0
| if |e
0
| < .
If K < 1, K
n+1
0 and K
n+1
|e
0
| 0 as n for any value of e
0
. Hence, |e
n+1
| =
|r x
n+1
| 0. Therefore, x
n+1
approaches the exact root r as n . As a result, the
xed point iteration x
n+1
= g(x
n
) converges to r for any initial value x
0
(r , r +) if
(x)
(r)
> 1.
EXAMPLE
Two rearrangements of the equation e
x
= sin x are
x = log(sin x) and x = arcsin
(
e
x
)
.
Determine if the xed point iteration method will converge to the rst positive
solution r 0.6 for these rearrangements. If the iteration does converge, compute
x
3
using initial value of 0.6.
Lecture Notes MATH2114 Numerical Methods and Statistics for Engineers 9
solution:
If g(x) = log(sin x) then
g
(x) =
d
dx
[
log(sin x)
]
=
cos x
sin x
= cot x,
giving g
(r) = g
(x)
(x) =
d
dx
arcsin
(
e
x
)
=
e
x
1 e
2x
,
so g
(r) = g
(0.6) 0.6565. As
(x)
(x)
.
4 Rate of Convergence
Suppose x
0
, x
1
, x
2
, . . . , is a sequence of approximation to a root, r . If x
n
r as n ,
we say the sequence is convergent. The rate of convergence is important. If
lim
n
|r x
n+1
|
|r x
n
|
p
= lim
n
|e
n+1
|
|e
n
|
p
= K
for positive constants K and p, we say that x
n
converges to r with order of convergence
p. The larger the value of p and the smaller the value of K, the faster the convergence. If
p = 1 and K < 1, the sequence is said to converge linearly, and if p = 2, the convergence
is quadratic.
10 Solution of Nonlinear Equations
For the xed point iteration method, x
n+1
= g(x
n
), it was shown that
e
n+1
= g
(c
n
)e
n
where c
n
(x
n
, r) .
Thus,
lim
n
|e
n+1
|
|e
n
|
= lim
n
(c
n
)
(r)
,
so iteration will converge linearly if K =
(r)
< 1. If g
(x
0
)
slope = f
(x
1
)
y = f(x)
(x
0
, f(x
0
))
(x
1
, f(x
1
))
y
The Newtons method can be derived on the basis of the geometrical interpretation of
the above illustration. Suppose f(x) is dierentiable, and has a root at an unknown point
x = r. If we have a point x
0
close to r, we could obtain a better approximation to r by
Lecture Notes MATH2114 Numerical Methods and Statistics for Engineers 11
drawing a tangent line through the point
(
x
0
, f(x
0
)
)
. This tangent line given by
f
(x
0
)
rise
run
=
f(x
0
) 0
x
0
x
1
would cut the x-axis at x = x
1
, which will be our new estimate of r. Solving for x
1
gives
x
1
= x
0
f(x
0
)
f
(x
0
)
provided f
(x
0
) = 0.
Repeat the procedure at
(
x
1
, f(x
1
)
)
, and let x
2
be the x-intercept of the second tangent
line. From
f
(x
1
) =
f(x
1
) 0
x
1
x
2
,
we obtain
x
2
= x
1
f(x
1
)
f
(x
1
)
provided f
(x
1
) = 0.
Continuing in this manner, we determine x
n+1
from
x
n+1
= x
n
f(x
n
)
f
(x
n
)
for n = 0, 1, 2, . . . and provided f
(x
n
) = 0.
The repetitive use of the above formula yields a sequence x
1
, x
2
, x
3
, . . . , of approximations
that converges to the root r ; that is, x
n
r as n . This method is called Newtons
method or Newton-Raphson method. A potential problem in implementing this method
is the evaluation of the derivative. Although this is not inconvenient for polynomials and
many other functions, there are certain functions whose derivatives may be impossible,
extremely dicult (if possible), or computationally expensive to evaluate. For these cases,
the derivative can be approximated by a backward nite divided dierence approximation,
f
(x
n
)
f(x
n
) f(x
n1
)
x
n
x
n1
.
EXAMPLE
Perform two iterations of Newtons method with x
0
= 1.2 to nd an estimate of the
root of x 1 = e
x
.
solution:
Let f(x) = x 1 e
x
. Then, f
(x) = 1 + e
x
, and
x
n+1
= x
n
x
n
1 e
x
n
1 + e
x
n
for n = 0, 1, 2, . . . .
12 Solution of Nonlinear Equations
Newtons iterations :
x
1
= x
0
x
0
1 e
x
0
1 + e
x
0
= 1.2
1.2 1 e
1.2
1 + e
1.2
= 1.277770 ,
x
2
= x
1
x
1
1 e
x
1
1 + e
x
1
= 1.277770
1.277770 1 e
1.277770
1 + e
1.277770
= 1.278465 .
Hence, r x
2
= 1.2785 .
6.1 Convergence and Stopping Criterions
Newtons method converges quadratically (p = 2) to a simple root, since
lim
n
|e
n+1
|
|e
n
|
p
= lim
n
|r x
n+1
|
|r x
n
|
2
= lim
n
(c
n
)
2f
(x
n
)
=
|f
(r)|
2 |f
(r)|
(note x
n
r as n )
= K.
But, for a multiple root f
(x) = 3x
2
, and
x
n+1
= x
n
f(x
n
)
f
(x
n
)
= x
n
x
3
n
2
3x
2
n
for n = 0, 1, 2, . . . .
For n = 0 (rst iteration):
x
1
= x
0
x
3
0
2
3x
2
0
= 1.2
(1.2)
3
2
3 (1.2)
2
= 1.262963 .
Since |x
1
x
0
| = 0.062963 > 0.0005, we continue with the next iteration (n = 1):
x
2
= x
1
x
3
1
2
3x
2
1
= 1.262963
(1.262963)
3
2
3 (1.262963)
2
= 1.259928 .
Again, |x
2
x
1
| = 0.003035 > 0.0005, so we continue to the next iteration (n = 2):
x
3
= x
2
x
3
2
2
3x
2
2
= 1.259928
(1.259928)
3
2
3 (1.259928)
2
= 1.259921 .
Now, |x
3
x
2
| = 7.321 (10
6
) < 0.0005, then the iteration process is terminated,
and x
3
= 1.259921 is accepted as an approximation to r. That is, r 1.256. Note
that the exact solution is
3
f(x
1
)(x
1
x
0
)
f(x
1
) f(x
0
)
.
The next approximation x
3
is computed in the same manner from x
1
and x
2
, and so on.
The secant method can be formulated as
x
n+1
= x
n
f(x
n
)(x
n
x
n1
)
f(x
n
) f(x
n1
)
for n = 1, 2, 3, . . . .
7.1 Convergence and Stopping Criterions
For some problems, the secant method may not converge for some choices of x
0
and x
1
.
However, convergence is guaranteed if x
0
and x
1
are suciently close to r. The order of
convergence of the secant method is
p =
1 +
5
2
1.618 .
Lecture Notes MATH2114 Numerical Methods and Statistics for Engineers 15
Consequently, the secant method can be expected to converge much faster than the bisec-
tion method (p = 1) or xed point iteration method (p = 1), but slower than the Newtons
method (p = 2). For a simple root with x
n
close to r, we have r x
n
x
n+1
x
n
. The
secant method is therefore terminated when
|x
n+1
x
n
| ,
which will ensure that |r x
n
| for a simple root.
EXAMPLE
Perform two iterations of the secant method with x
0
= 1.3 and x
1
= 1.1 to nd an
estimate of the root of x 1 = e
x
.
solution:
Let f(x) = x 1 e
x
. Then,
x
2
= x
1
f(x
1
)(x
1
x
0
)
f(x
1
) f(x
0
)
= 1.1
f(1.1)(1.1 1.3)
f(1.1) f(1.3)
= 1.278898 ,
and
x
3
= x
2
f(x
2
)(x
2
x
1
)
f(x
2
) f(x
1
)
= 1.278898
f(1.278898)(1.278898 1.1)
f(1.278898) f(1.1)
= 1.278473 .
After two iterations, the estimate is r x
3
= 1.278 .
8 Remarks on Multiple Roots
A multiple root corresponds to a point where a function is tangent to the x-axis. For
example, a double root results from
f(x) = (x 2)(x 1)(x 1),
or mutliplying terms, f(x) = x
3
4x
2
+ 5x 2. The equation has a double root, because
one value of x makes two terms in f(x) equal to zero. Graphically, this corresponds to
the curve touching the x-axis tangentially at the double root (the function touches the
16 Solution of Nonlinear Equations
axis, but does not cross it at the root). A triple root corresponds to the case where one
x value makes three terms in an equation equal to zero, as in
f(x) = (x 2)(x 1)(x 1)(x 1),
or multiplying terms, f(x) = x
4
5x
3
+9x
2
7x+2. Graphically, this function is tangent
to the axis at the root, but for this case the axis crossed. In general, odd multiple roots
cross the axis, whereas even ones do not. For example, the quadruple root (four repeated
roots) does not cross the axis.
Multiple roots pose some diculties for many of the numerical methods presented in
this document :
(1) The fact that the function does not change sign at even multiple roots precludes
the use of the reliable bracketing methods such as the bisection method. Therefore,
you are limited to the xed point iteration method that may diverge.
(2) Another issue is related to the fact that not only f(x), but also f
(x) goes to
zero at the root. This poses problems for both the Newtons method and secant
method, which both contain the derivative (or its estimate) in the denominator of
their respective formulae. This could result in division by zero when the solution
converges very close to the root.
(3) It can be demonstrated that the Newtons method and secant method are linearly,
rather than quadratically, convergent for multiple roots. However, the formula for
the Newtons method can be slightly modied in the following manner to return the
method to its quadratic convergence,
x
n+1
= x
n
m
f(x
n
)
f
(x
n
)
,
where m is the multiplicity of the root. That is, m = 2 for a double root, m = 3
for a triple root, etc. Of course, this may be an unsatisfactory alternative, because
it hinges on foreknowledge of the multiplicity of the root. Another alternative is to
dene a new function u(x) as the ratio of the function to its derivative,
u(x) =
f(x)
f
(x)
.
It can be shown that this function has roots at all the same locations as the original
function. Therefore, this function can be inserted into the Newtons method to
develop an alternative form,
x
n+1
= x
n
u(x
n
)
u
(x
n
)
.
Lecture Notes MATH2114 Numerical Methods and Statistics for Engineers 17
9 Self Assessment Exercises
[1] Beginning with the interval [0, /2], carry out three iterations of the bisection
method to nd an estimate of the root of 5x = 4 + sin x.
[2] Use the bisection method with a tolerance of 1/20 to nd the solution of x = 2 sin x
that lies in the interval x [1, 2].
[3] Determine the error bound for the estimate of the solution after ve iterations of
the bisection method if initial interval [2, 1.6] is used.
[4] Estimate the number of iterations required by the bisection method to nd the root
of x 2 sin x = 0 that lies between x = 1 and x = 2 for the tolerance of 10
6
.
[5] Show that the iteration x
n+1
= 2 sin x
n
will converge to the rst positive root
(r 1.9) of x 2 sin x = 0. Using x
0
= 1.9, compute x
3
.
[6] Two rearrangements of the equation,
e
x
= 2 cos x,
are x = ln(2 cos x) and x = arccos(
1
2
e
x
). Are either of these suitable to nd the
root r 1.5 using a xed point iteration method ?
[7] Show that the bisection method converges linearly with K = 1/2.
[8] Using x
0
= 1.5, perform two iterations of the Newtons method to nd an estimate
of the root of x = 2 sin x.
[9] Estimate the negative solution of e
x/2
= 2 x
2
using the Newtons method with
x
0
= 1.2 and a tolerance of 10
4
.
[10] Using the secant method with x
0
= 1 and x
1
= 2, nd the approximation x
3
to the
positive root of x = 2 sin x.
[11] Compute the negative solution of e
x/2
= 2x
2
to three decimal place accuracy (use
= 0.0005) using the secant method with x
0
= 1.2 and x
1
= 1.3 .
[12] Suppose we wish to solve the nonlinear equation, x = 0.8 + 0.2 sin x.
(a) Beginning with the interval [0, /2], perform three iterations of the bisection
method.
(b) How many iterations of the bisection method are required to estimate the
solution to within 10
4
?
18 Solution of Nonlinear Equations
(c) Use Newtons method with x
0
= /4 to estimate x
1
and x
2
.
(d) What is the approximate size of the error of x
2
, obtained from the Newtons
method, as an estimate of the solution of the above equation ?
(e) Taking x
0
= 0 and x
1
= /2, compute x
2
and x
3
using the secant method.
[13] Suppose we wish to solve the nonlinear equation,
f(x) = x e
x1
= 0.
(a) Use Newtons method to nd improved approximations x
1
, x
2
and x
3
from an
initial approximation x
0
= 2.
(b) Describe the observed rate of convergence of Newtons method given that the
exact solution is x = 1. What do the results suggest about the nature of the
solution at x = 1 ?
[14] Given f(x) = 2x
6
1.6x
4
+ 12x + 1. Use bisection method to determine the
maximum of this function. Employ initial interval of [0, 1], and perform iterations
until the error is less than 0.005.
[15] The velocity v of a falling parachutist is given by
v =
gm
c
d
(
1 e
ct/m
)
where g = 9.8 m/s
2
. For a parachutist with a drag coecient c
d
= 15 kg/s, compute
the mass m, so that the velocity is 35 m/s at time t = 9 s . Use the bisection method
to nd m to three decimal places accuracy.