Contents
Brent's method
In numerical analysis, Brent's method is a hybrid root-finding algorithm combining the bisection method, the secant method and inverse quadratic interpolation. It has the reliability of bisection but it can be as quick as some of the less-reliable methods. The algorithm tries to use the potentially fast-converging secant method or inverse quadratic interpolation if possible, but it falls back to the more robust bisection method if necessary. Brent's method is due to Richard Brent and builds on an earlier algorithm by Theodorus Dekker. Consequently, the method is also known as the Brent–Dekker method. Modern improvements on Brent's method include Chandrupatla's method, which is simpler and faster for functions that are flat around their roots; Ridders' method, which performs exponential interpolations instead of quadratic providing a simpler closed formula for the iterations; and the ITP method which is a hybrid between regula-falsi and bisection that achieves optimal worst-case and asymptotic guarantees.
Dekker's method
The idea to combine the bisection method with the secant method goes back to. Suppose that we want to solve the equation f(x) = 0. As with the bisection method, we need to initialize Dekker's method with two points, say a0 and b0, such that f(a0) and f(b0) have opposite signs. If f is continuous on [a0, b0], the intermediate value theorem guarantees the existence of a solution between a0 and b0. Three points are involved in every iteration: Two provisional values for the next iterate are computed. The first one is given by linear interpolation, also known as the secant method: and the second one is given by the bisection method If the result of the secant method, s, lies strictly between bk and m, then it becomes the next iterate (bk+1 = s), otherwise the midpoint is used (bk+1 = m). Then, the value of the new contrapoint is chosen such that f(ak+1) and f(bk+1) have opposite signs. If f(ak) and f(bk+1) have opposite signs, then the contrapoint remains the same: ak+1 = ak. Otherwise, f(bk+1) and f(bk) have opposite signs, so the new contrapoint becomes ak+1 = bk. Finally, if |f(ak+1)| < |f(bk+1)|, then ak+1 is probably a better guess for the solution than bk+1, and hence the values of ak+1 and bk+1 are exchanged. This ends the description of a single iteration of Dekker's method. Dekker's method performs well if the function f is reasonably well-behaved. However, there are circumstances in which every iteration employs the secant method, but the iterates bk converge very slowly (in particular, |bk − bk−1| may be arbitrarily small). Dekker's method requires far more iterations than the bisection method in this case.
Brent's method
proposed a small modification to avoid the problem with Dekker's method. He inserts an additional test which must be satisfied before the result of the secant method is accepted as the next iterate. Two inequalities must be simultaneously satisfied: Given a specific numerical tolerance \delta, if the previous step used the bisection method, the inequality must hold to perform interpolation, otherwise the bisection method is performed and its result used for the next iteration. If the previous step performed interpolation, then the inequality is used instead to perform the next action (to choose) interpolation (when inequality is true) or bisection method (when inequality is not true). Also, if the previous step used the bisection method, the inequality must hold, otherwise the bisection method is performed and its result used for the next iteration. If the previous step performed interpolation, then the inequality is used instead. This modification ensures that at the kth iteration, a bisection step will be performed in at most additional iterations, because the above conditions force consecutive interpolation step sizes to halve every two iterations, and after at most iterations, the step size will be smaller than \delta, which invokes a bisection step. Brent proved that his method requires at most N2 iterations, where N denotes the number of iterations for the bisection method. If the function f is well-behaved, then Brent's method will usually proceed by either inverse quadratic or linear interpolation, in which case it will converge superlinearly. Furthermore, Brent's method uses inverse quadratic interpolation instead of linear interpolation (as used by the secant method). If f(bk), f(ak) and f(bk−1) are distinct, it slightly increases the efficiency. As a consequence, the condition for accepting s (the value proposed by either linear interpolation or inverse quadratic interpolation) has to be changed: s has to lie between (3ak + bk) / 4 and bk.
Algorithm
input a, b, and (a pointer to) a function for f calculate f(a) calculate f(b) if f(a)f(b) ≥ 0 then exit function because the root is not bracketed. end if if |f(a)| < |f(b)| then swap (a,b) end if c := a set mflag repeat until f(b or s) = 0 or |b − a| is small enough (convergence) if f(a) ≠ f(c) and f(b) ≠ f(c) then (inverse quadratic interpolation) else (secant method) end if if (condition 1) s is not between (3a+b)/4 and b or (condition 2) (mflag is set and |s−b| ≥ |b−c|/2) or (condition 3) (mflag is cleared and |s−b| ≥ |c−d|/2) or (condition 4) (mflag is set and |b−c| < |δ|) or (condition 5) (mflag is cleared and |c−d| < |δ|) then (bisection method) set mflag else clear mflag end if calculate f(s) d := c (d is assigned for the first time here; it won't be used above on the first iteration because mflag is set) c := b if f(a)f(s) < 0 then b := s else a := s end if if |f(a)| < |f(b)| then swap (a,b) end if end repeat output b or s (return the root)
Example
Suppose that we are seeking a zero of the function defined by f(x) = (x + 3)(x − 1)2. We take [a0, b0] = [−4, 4/3] as our initial interval. We have f(a0) = −25 and f(b0) = 0.48148 (all numbers in this section are rounded), so the conditions f(a0) f(b0) < 0 and |f(b0)| ≤ |f(a0)| are satisfied.
Implementations
This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.
Wikipedia® is a registered trademark of the
Wikimedia Foundation, Inc.
Bliptext is not
affiliated with or endorsed by Wikipedia or the
Wikimedia Foundation.