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[1] and builds on an earlier algorithm by Theodorus Dekker.
Modern improvements on Brent's method include Chandrupatla's method, which is simpler and faster for functions that are flat around their roots;[3][4] 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.
If f is continuous on [a0, b0], the intermediate value theorem guarantees the existence of a solution between a0 and b0.
Then, the value of the new contrapoint is chosen such that f(ak+1) and f(bk+1) have opposite signs.
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).
Brent (1973) 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
, if the previous step used the bisection method, the inequality
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
This modification ensures that at the kth iteration, a bisection step will be performed in at most
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.
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.
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.