Abstract
In computational physics very often roots and local extrema of a function have to be determined. In one dimension bisection is a very robust but rather inefficient root finding method. If a good starting point close to the root is available and the function is smooth enough, the Newton-Raphson method converges much faster. Special strategies are necessary to find roots of not so well behaved functions or higher order roots. The combination of bisection and interpolation as by the methods of Dekker, Brent and more recently Chandrupatla provides generally applicable algorithms. In multidimensions Quasi-Newton methods are a good choice. Whereas local extrema can be found as the roots of the gradient, at least in principle, direct optimization can be more efficient. In one dimension the ternary search method or Brent’s more efficient golden section search method can be used. In multidimensions the class of direction set search methods is very popular which includes the methods of steepest descent and conjugate gradients, the Newton-Raphson method and, if calculation of the full Hessian matrix is too expensive, the Quasi-Newton methods.
Access provided by Autonomous University of Puebla. Download chapter PDF
Similar content being viewed by others
Keywords
- Full Hessian Matrix
- Higher Order Roots
- Bisection Property
- quasi-Newton Condition
- Golden Section Search Method
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
In computational physics very often roots of a function, i.e. solutions of an equation like
have to be determined. A related problem is the search for local extrema (Fig. 6.1)
which for a smooth function are solutions of the equations
In one dimension bisection is a very robust but rather inefficient root finding method. If a good starting point close to the root is available and the function smooth enough, the Newton-Raphson method converges much faster. Special strategies are necessary to find roots of not so well behaved functions or higher order roots. The combination of bisection and interpolation like in Dekker’s and Brent’s methods provides generally applicable algorithms. In multidimensions calculation of the Jacobian matrix is not always possible and Quasi-Newton methods are a good choice. Whereas local extrema can be found as the roots of the gradient, at least in principle, direct optimization can be more efficient. In one dimension the ternary search method or Brent’s more efficient golden section search method can be used. In multidimensions the class of direction set search methods is very popular which includes the methods of steepest descent and conjugate gradients, the Newton-Raphson method and, if calculation of the full Hessian matrix is too expensive, the Quasi-Newton methods.
1 Root Finding
If there is exactly one root in the interval a 0<x<b 0 then one of the following methods can be used to locate the position with sufficient accuracy. If there are multiple roots, these methods will find one of them and special care has to be taken to locate the other roots.
1.1 Bisection
The simplest method [45] to solve
uses the following algorithm (Fig. 6.2):
-
(1)
Determine an interval [a 0,b 0], which contains a sign change of f(x). If no such interval can be found then f(x) does not have any zero crossings.
-
(2)
Divide the interval into \([a_{0},a_{0}+\frac{b_{0}-a_{0}}{2}]\) \([a_{0}+\frac{b_{0}-a_{0}}{2},b_{0}]\) and choose that interval [a 1,b 1], where f(x) changes its sign.
-
(3)
repeat until the width b n −a n <ε is small enough.Footnote 1
The bisection method needs two starting points which bracket a sign change of the function. It converges but only slowly since each step reduces the uncertainty by a factor of 2.
1.2 Regula Falsi (False Position) Method
The regula falsi [92] method (Fig. 6.3) is similar to the bisection method [45]. However, polynomial interpolation is used to divide the interval [x r ,a r ] with f(x r )f(a r )<0. The root of the linear polynomial
is given by
which is inside the interval [x r ,a r ]. Choose the sub-interval which contains the sign change:
Then ξ r provides a series of approximations with increasing precision to the root of f(x)=0.
1.3 Newton-Raphson Method
Consider a function which is differentiable at least two times around the root ξ. Taylor series expansion around a point x 0 in the vicinity
gives for x=ξ
Truncation of the series and solving for ξ gives the first order Newton-Raphson [45, 252] method (Fig. 6.4)
and the second order Newton-Raphson method (Fig. 6.4)
The Newton-Raphson method converges fast if the starting point is close enough to the root. Analytic derivatives are needed. It may fail if two or more roots are close by.
1.4 Secant Method
Replacing the derivative in the first order Newton Raphson method by a finite difference quotient gives the secant method [45] (Fig. 6.5) which has been known for thousands of years before [196]
Round-off errors can become important as |f(x r )−f(x r−1)| gets small. At the beginning choose a starting point x 0 and determine
using a symmetrical difference quotient.
1.5 Interpolation
The secant method is also obtained by linear interpolation
The root of the polynomial p(x r+1)=0 determines the next iterate x r+1
Quadratic interpolation of three function values is known as Muller’s method [177]. Newton’s form of the interpolating polynomial is
which can be rewritten
and has the roots
To avoid numerical cancellation, this is rewritten
The sign in the denominator is chosen such that x r+1 is the root closer to x r . The roots of the polynomial can become complex valued and therefore this method is useful to find complex roots.
1.6 Inverse Interpolation
Complex values of x r can be avoided by interpolation of the inverse function instead
Using the two points x r ,x r−1 the Lagrange method gives
and the next approximation of the root corresponds again to the secant method (6.12)
Inverse quadratic interpolation needs three starting points x r ,x r−1,x r−2 together with the function values f r ,f r−1,f r−2 (Fig. 6.6). The inverse function x=f −1(y) is interpolated with the Lagrange method
For y=0 we find the next iterate
Inverse quadratic interpolation is only a good approximation if the interpolating parabola is single valued and hence if it is a monotonous function in the range of f r ,f r−1,f r−2. For the following discussion we assume that the three values of x are renamed such that x 1<x 2<x 3.
Consider the limiting case (a) in Fig. 6.7 where the polynomial has a horizontal tangent at y=f 3 and can be written as
Its value at y=0 is
If f 1 and f 3 have different sign and |f 1|<|f 3| (Sect. 6.1.7.2) we find
Brent [36] used this as a criterion for the applicability of the inverse quadratic interpolation. However, this does not include all possible cases where interpolation is applicable. Chandrupatla [54] gave a more general discussion. The limiting condition is that the polynomial p(y) has a horizontal tangent at one of the boundaries x 1,3. The derivative values are
with [54]
Since for a parabola either f 1<f 2<f 3 or f 1>f 2>f 3 the conditions for applicability of inverse interpolation finally become
which can be combined into
This method is usually used in combination with other methods (Sect. 6.1.7.2).
1.7 Combined Methods
Bisection converges slowly. The interpolation methods converge faster but are less reliable. The combination of both gives methods which are reliable and converge faster than pure bisection.
1.7.1 Dekker’s Method
Dekker’s method [47, 70] combines bisection and secant method. The root is bracketed by intervals [c r ,b r ] with decreasing width where b r is the best approximation to the root found and c r is an earlier guess for which f(c r ) and f(b r ) have different sign. First an attempt is made to use linear interpolation between the points (b r ,f(b r )) and (a r ,f(a r )) where a r is usually the preceding approximation a r =b r−1 and is set to the second interval boundary a r =c r−1 if the last iteration did not lower the function value (Fig. 6.8).
Starting from an initial interval [x 0,x 1] with sign(f(x 0))≠sign(f(x 1)) the method proceeds as follows [47]:
-
initialization
-
iteration
If x s is very close to the last b then increase the distance to avoid too small steps else choose x s if it is between b and x m , otherwise choose x m (thus choosing the smaller interval)
Determine x k as the latest of the previous iterates x 0…x r−1 for which sign(f(x k ))≠sign(f(x r )).
If the new function value is lower update the approximation to the root
otherwise keep the old approximation and update the second interval boundary
repeat until |c−b|<ε or f r =0.
1.7.2 Brent’s Method
In certain cases Dekker’s method converges very slowly making many small steps of the order ε. Brent [36, 37, 47] introduced some modifications to reduce such problems and tried to speed up convergence by the use of inverse quadratic interpolation (Sect. 6.1.6). To avoid numerical problems the iterate (6.24) is written with the help of a quotient
with
If only two points are available linear interpolation is used. The iterate (6.22) then is written as
with
The division is only performed if interpolation is appropriate and division by zero cannot happen. Brent’s method is fast and robust at the same time. It is often recommended by text books. The algorithm is summarized in the following [209].
Start with an initial interval [x 0,x 1] with f(x 0)f(x 1)≤0
-
initialization
-
iteration
If c is a better approximation than b exchange values
calculate midpoint relative to b
stop if accuracy is sufficient
use bisection if the previous step width e was too small or the last step did not improve
otherwise try interpolation
make p a positive quantity
update previous step width
use interpolation if applicable, otherwise use bisection
calculate new function value
be sure to bracket the root
1.7.3 Chandrupatla’s method
In 1997 Chandrupatla [54] published a method which tries to use inverse quadratic interpolation whenever possible according to (6.34). He calculates the relative position of the new iterate as (Fig. 6.9)
The algorithm proceeds as follows:
Start with an initial interval [x 0,x 1] with f(x 0)f(x 1)≤0
-
initialization
-
iteration
Chandrupatlas’s method is more efficient than Dekker’s and Brent’s, especially for higher order roots (Figs. 6.10, 6.11, 6.12).
1.8 Multidimensional Root Finding
The Newton-Raphson method can be easily generalized for functions of more than one variable. We search for the solution of a system of n nonlinear equations in n variables x i
The first order Newton-Raphson method results from linearization of
with the Jacobian matrix
If the Jacobian matrix is not singular the equation
can be solved by
This can be repeated iteratively
1.9 Quasi-Newton Methods
Calculation of the Jacobian matrix can be very time consuming. Quasi-Newton methods use instead an approximation to the Jacobian which is updated during each iteration. Defining the differences
we obtain from the truncated Taylor series
the so called Quasi-Newton or secant condition
We attempt to construct a family of successive approximation matrices J r so that, if J were a constant, the procedure would become consistent with the Quasi-Newton condition. Then for the new update J r+1 we have
Since d (r),y (r) are already known, these are only n equations for the n 2 elements of J r+1. To specify J r+1 uniquely, additional conditions are required. For instance, it is reasonable to assume, that
Then J r+1 differs from J r only by a rank one updating matrix
From the secant condition we obtain
hence
This gives Broyden’s update formula [42]
To update the inverse Jacobian matrix, the Sherman-Morrison formula [236]
can be applied to have
2 Function Minimization
Minimization or maximization of a functionFootnote 2 is a fundamental task in numerical mathematics and closely related to root finding. If the function f(x) is continuously differentiable then at the extremal points the derivative is zero
Hence, in principle root finding methods can be applied to locate local extrema of a function. However, in some cases the derivative cannot be easily calculated or the function even is not differentiable. Then derivative free methods similar to bisection for root finding have to be used.
2.1 The Ternary Search Method
Ternary search is a simple method to determine the minimum of a unimodal function f(x). Initially we have to find an interval [a 0,b 0] which is certain to contain the minimum. Then the interval is divided into three equal parts [a 0,c 0], [c 0,d 0], [d 0,b 0] and either the first or the last of the three intervals is excluded (Fig. 6.13). The procedure is repeated with the remaining interval [a 1,b 1]=[a 0,d 0] or [a 1,b 1]=[c 0,b 0].
Each step needs two function evaluations and reduces the interval width by a factor of 2/3 until the maximum possible precision is obtained. It can be determined by considering a differentiable function which can be expanded around the minimum x 0 as
Numerically calculated function values f(x) and f(x 0) only differ, if
which limits the possible numerical accuracy to
and for reasonably well behaved functions (Fig. 6.14) we have the rule of thumb [207]
However, it may be impossible to reach even this precision, if the quadratic term of the Taylor series vanishes (Fig. 6.15).
The algorithm can be formulated as follows:
-
iteration
2.2 The Golden Section Search Method (Brent’s Method)
To bracket a local minimum of a unimodal function f(x) three points a,b,c are necessary (Fig. 6.16) with
The position of the minimum can be determined iteratively by choosing a new value ξ in the interval a<ξ<c and dropping either a or c, depending on the ratio of the function values. A reasonable choice for ξ can be found as follows (Fig. 6.17) [147, 207]. Let us denote the relative positions of the middle point and the trial point as
The relative width of the new interval will be
The golden search method requires that
Otherwise it would be possible that the larger interval width is selected many times slowing down the convergence. The value of t is positive if c−b>b−a and negative if c−b<b−a, hence the trial point always is in the larger of the two intervals. In addition the golden search method requires that the ratio of the spacing remains constant. Therefore we set
Eliminating t we obtain for a<ξ<b the equation
Besides the trivial solution β=1 there is only one positive solution
For b<ξ<c we end up with
which has the nontrivial positive solution
Hence the lengths of the two intervals [a,b], [b,c] have to be in the golden ratio \(\varphi=\frac{1+\sqrt{5}}{2}\approx1.618\) which gives the method its name. Using the golden ratio the width of the interval bracketing the minimum reduces by a factor of 0.618 (Figs. 6.18, 6.19).
The algorithm can be formulated as follows:
To start the method we need three initial points which can be found by Brent’s exponential search method (Fig. 6.20). Begin with three points
where h 0 is a suitable initial step width which depends on the problem. If the minimum is not already bracketed then if necessary exchange a 0 and b 0 to have
Then replace the three points by
and repeat this step until
or n exceeds a given maximum number. In this case no minimum can be found and we should check if the initial step width was too large.
Brent’s method can be improved by making use of derivatives and by combining the golden section search with parabolic interpolation [207].
2.3 Minimization in Multidimensions
We search for local minima (or maxima) of a function
which is at least two times differentiable. In the following we denote the gradient vector by
and the matrix of second derivatives (Hessian) by
The very popular class of direction set methods proceeds as follows (Fig. 6.21). Starting from an initial guess x 0 a set of direction vectors s r and step lengths λ r is determined such that the series of vectors
approaches the minimum of h(x). The method stops if the norm of the gradient becomes sufficiently small or if no lower function value can be found.
2.4 Steepest Descent Method
The simplest choice, which is known as the method of gradient descent or steepest descentFootnote 3 is to go in the direction of the negative gradient
and to determine the step length by minimizing h along this direction
Obviously two consecutive steps are orthogonal to each other since
This can lead to a zig-zagging behavior and a very slow convergence of this method (Figs. 6.22, 6.23).
2.5 Conjugate Gradient Method
This method is similar to the steepest descent method but the search direction is iterated according to
where λ r is chosen to minimize h(x r+1) and the simplest choice for β is made by Fletcher and Rieves [89]
2.6 Newton-Raphson Method
The first order Newton-Raphson method uses the iteration
The search direction is
and the step length is λ=1. This method converges fast if the starting point is close to the minimum. However, calculation of the Hessian can be very time consuming (Fig. 6.22).
2.7 Quasi-Newton Methods
Calculation of the full Hessian matrix as needed for the Newton-Raphson method can be very time consuming. Quasi-Newton methods use instead an approximation to the Hessian which is updated during each iteration. From the Taylor series
we obtain the gradient
Defining the differences
and neglecting higher order terms we obtain the Quasi-Newton or secant condition
We want to approximate the true Hessian by a series of matrices H r which are updated during each iteration to sum up all the information gathered so far. Since the Hessian is symmetric and positive definite, this also has to be demanded for the H r .Footnote 4 This cannot be achieved by a rank one update matrix. Popular methods use a symmetric rank two update of the form
The Quasi-Newton condition then gives
hence H r d r −y r must be a linear combination of u and v. Making the simple choice
and assuming that these two vectors are linearly independent, we find
which together defines the very popular BFGS (Broyden, Fletcher, Goldfarb, Shanno) method [43, 86, 105, 235]
Alternatively the DFP method by Davidon, Fletcher and Powell, directly updates the inverse Hessian matrix B=H −1 according to
Both of these methods can be inverted with the help of the Sherman-Morrison formula to give
3 Problems
Problem 6.1
(Root finding methods)
This computer experiment searches roots of several test functions:
You can vary the initial interval or starting value and compare the behavior of different methods:
-
bisection
-
regula falsi
-
Dekker’s method
-
Brent’s method
-
Chandrupatla’s method
-
Newton-Raphson method
Problem 6.2
(Stationary points)
This computer experiment searches a local minimum of the Rosenbrock functionFootnote 5
-
The method of steepest descent minimizes h(x,y) along the search direction
$$\begin{aligned} s_{x}^{(n)}=-g_{x}^{(n)}=-400x \bigl(x_{n}^{2}-y_{n}\bigr)-2(x_{n}-1)& \end{aligned}$$(6.106)$$\begin{aligned} s_{y}^{(n)}=-g_{y}^{(n)}=-200 \bigl(y_{n}-x_{n}^{2}\bigr).& \end{aligned}$$(6.107) -
Conjugate gradients make use of the search direction
$$\begin{aligned} s_{x}^{(n)}=-g_{x}^{(n)}+ \beta_{n}s_{x}^{(n-1)} \end{aligned}$$(6.108)
-
The Newton-Raphson method needs the inverse Hessian
$$\begin{aligned} H^{-1}=\frac{1}{\det(H)}\left ( \begin{array}{cc} h_{yy} & -h_{xy}\\ -h_{xy} & h_{xx} \end{array} \right ) \end{aligned}$$(6.110)
and iterates according to
You can choose an initial point (x 0,y 0). The iteration stops if the gradient norm falls below 10−14 or if the line search fails to find a lower function value.
Notes
- 1.
Usually a combination like ε=2ε M +|b n |ε r of an absolute and a relative tolerance is taken.
- 2.
In the following we consider only a minimum since a maximum could be found as the minimum of −f(x).
- 3.
Which should not be confused with the method of steepest descent for the approximate calculation of integrals.
- 4.
This is a major difference to the Quasi-Newton methods for root finding (6.1.9).
- 5.
A well known test function for minimization algorithms.
References
R.P. Brent, Comput. J. 14, 422 (1971)
R.P. Brent, Algorithms for Minimization without Derivatives (Prentice Hall, Englewood Cliffs, 1973), Chap. 4
C.G. Broyden, Math. Comput. 19, 577 (1965)
C.G. Broyden, J. Inst. Math. Appl. 6, 76 (1970)
R.L. Burden, J.D. Faires, Numerical Analysis (Brooks Cole, Boston, 2010), Chap. 2
J.C.P. Bus, T.J. Dekker, ACM Trans. Math. Softw. 1, 330 (1975)
T.R. Chandrupatla, Adv. Eng. Softw. 28, 145 (1997)
T.J. Dekker, Finding a zero by means of successive linear interpolation, in Constructive Aspects of the Fundamental Theorem of Algebra, ed. by B. Dejon, P. Henrici (Wiley-Interscience, London, 1969)
R. Fletcher, Comput. J. 13, 317 (1970)
R. Fletcher, C. Reeves, Comput. J. 7, 149 (1964)
J.A. Ford, Improved Algorithms of Illinois-Type for the Numerical Solution of Nonlinear Equations (University of Essex Press, Essex, 1995), Technical Report CSM-257
D. Goldfarb, Math. Comput. 24, 23 (1970)
J. Kiefer, Proc. Am. Math. Soc. 4, 502–506 (1953)
D.E. Muller, Math. Tables Other Aids Comput. 10, 208 (1956)
J.M. Papakonstantinou, A historical development of the (n+1)-point secant method. M.A. thesis, Rice University Electronic Theses and Dissertations, 2007
W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery, Golden section search in one dimension, in Numerical Recipes: The Art of Scientific Computing, 3rd edn. (Cambridge University Press, New York, 2007). ISBN 978-0-521-88068-8, Sect. 10.2
A. Quarteroni, R. Sacco, F. Saleri, Numerical Mathematics, 2nd edn. (Springer, Berlin, 2007)
D.F. Shanno, Math. Comput. 24, 647 (1970)
J. Sherman, W.J. Morrison, Ann. Math. Stat. 20, 621 (1949)
J.Y. Tjalling, Historical development of the Newton-Raphson method. SIAM Rev. 37, 531 (1995)
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Scherer, P.O.J. (2013). Roots and Extremal Points. In: Computational Physics. Graduate Texts in Physics. Springer, Heidelberg. https://doi.org/10.1007/978-3-319-00401-3_6
Download citation
DOI: https://doi.org/10.1007/978-3-319-00401-3_6
Publisher Name: Springer, Heidelberg
Print ISBN: 978-3-319-00400-6
Online ISBN: 978-3-319-00401-3
eBook Packages: Physics and AstronomyPhysics and Astronomy (R0)