A Robust Hybrid Method
6.2.4 A Robust Hybrid Method
Efficient and robust root finders can be constructed by combining the secant method (or some higher-order interpolation method) with bisection. A particularly elegant combination of bisection and the secant method was developed in the 1960s by van Wijngaarden, Dekker, and others at the Mathematical Center in Amsterdam; see [61]. It uses a rapidly convergent method for smooth functions and the slow but sure bisection method when necessary. This
Review Questions 635 algorithm was taken up and improved by Brent [44]; see also [123, Section 7.2]. In contrast
to Dekker’s algorithm, Brent’s new algorithm zeroin never converges much more slowly than bisection.
In each of the iterations of zeroin three approximations a, b, and c to the root are present. Initially we are given an interval [a, b] such that f (a) and f (b) have opposite sign,
and set c = a. In the following steps a, b, and c are arranged so that • f (a) and f (b) have opposite sign, and |f (b)| ≤ |f (a)|. • b is the latest iteration.
• c is the value of b in the previous step. At all times a and b bracket the zero and the length |b − a| of the interval shrinks in each
iteration. If c = a a secant step is taken; otherwise inverse quadratic interpolation is used. If the
computed step gives an approximation in [a, b] (and not too close to one of the endpoints) take it; otherwise a bisection step is taken. The iterations are terminated if f (b) = 0, or
|b − a| ≤ tol + 4u|b|,
where tol is a user tolerance and u the unit roundoff. The midpoint r = b + 0.5(a − b) is then returned as the root.
Brent claims that his version of zeroin will always converge, even in floating-point arithmetic. Further, if f has a continuous second derivative the method will eventually converge at least as fast as the secant method. In this case typically about ten function eval- uations are needed. He never found a function requiring more than three times the number of evaluations needed for bisection. On average, using inverse quadratic interpolation when possible saves 0.5 function evaluations over using only the secant method.
The MATLAB function fzero , which finds a zero near a given approximation x 0 , is based on zeroin . A discussion of a slightly simplified version of fzero is given in Moler [268, Chap. 4.7].
ReviewQuestions
6.2.1 Sketch a function f (x) with a root in (a, b) such that regula falsi converges very slowly.
6.2.2 Outline how the secant method can be safeguarded by combining it with the bisection method.
6.2.3 What property should the function f (x) have to be unimodal on the interval [a, b]?
6.2.4 Discuss root finding methods based on quadratic interpolation (the Muller–Traub method) and inverse quadratic interpolation. What are the merits of these two ap- proaches?
636 Chapter 6. Solving Scalar Nonlinear Equations
Problems and Computer Exercises
6.2.1 Use the secant method to determine the roots of the following equations to six correct decimals.
(a) 2x = e −x ;
(b) tan x + cosh x = 0.
0, then in the next step we compute x n +2 by a secant step; otherwise we use a line through (x n +1 ,f n +1 ) and (x n −1 , θf n −1 ) , where 0 < θ < 1. Clearly, θ = 1 corresponds to a
6.2.2 Assume that we have f n f n −1 <
0, and have computed x n +1 . If f n +1 f n <
step with the method of false position and will usually give f n +2 f n +1 >
0. On the
other hand, θ = 0 gives x n +1 =x n , and thus f n +1 f n <
0. Hence a suitable choice of
θ will always give f n +2 f n +1 < 0.
Show that in a modified step ǫ n +1 ≈ −ǫ n when θ = 0.5. Deduce that the resulting algorithm gives cubic convergence with three function evaluations and hence has
efficiency index E = 3 180 = 1.4422 . . . .
6.2.3 Another modification of the secant method can be derived by estimating f ′ (x n ) in Newton’s method by quadratic interpolation through the points x n ,x n −1 ,x n −2 . Show that the resulting method can be written x n +1 =x n − f (x n )/ω , where
ω = f [x n ,x n −1 ] + (x n −x n −1 )f [x n ,x n −1 ,x n −2 ].
6.2.4 The Muller–Traub method uses three points to determine the coefficient of an inter- polating parabola. The same points can also be interpolated by a rational function of the form
x −a
g(x) =
bx +c An iterative method is derived by taking x n +1 equal to the root a of g(x) = 0.
(a) Show that this is equivalent to calculating x n +1 from the “modified secant formula”:
f [x n −1 ,x n −2 ] Hint: Use a theorem in projective geometry, according to which the cross ratio of any
f n −˜ f n −2
four values of x is equal to the cross ratio of the corresponding values of g(x) (see Householder [204, p. 159]). Hence
( 0−f n )/( 0−f n −2 ) (x n +1 −x n )/(x n +1 −x n −2 )
. (y n −1 −f n )/(y n −1 −f n −2 )
(x n −1 −x n )/(x n −1 −x n −2 ) (b) Use the result in (a) to show that x n −1 ∈ int(x n −2 ,x n ) if
sign(y n ) = −sign(y n −2 ), sign(y[x n ,x n −1 ]) = sign(y[x n −1 ,x n −2 ]).
180 The resulting modified rule of false position is often called, after its origin, the Illinois method. It is due originally to the staff of the computer center at the University of Illinois in the early 1950s.
6.3. Methods Using Derivatives 637
6.2.5 The result in Problem 6.2.4 suggests that the Illinois method in Problem 6.2.2 should
be modified by taking % β if β > 0, β = f [x n +1 ,x n ]/f [x n ,x n −1 ],
2 if β ≤ 0. Implement this modified method. Compare it with the unmodified Illinois method
and with the safeguarded secant algorithm. As test equations use the following: (a) A curve with one inflection point on [0, 1]:
2 =x n − (1 − x) , a = 25, b = 1, n = 2, 5, 10. (b) A family of curves which lie increasingly close to the x-axis for large n:
f (x)
f (x) =e −nx (x − 1) + x n , a = 0.25, b = 1, n = 5, 10, 15. (c) A family of curves with the y-axis asymptotic:
f (x) = (nx − 1)/((n − 1)x), a = 0.01, b = 1, n = 2, 5, 10.