Learn R Programming

pracma (version 1.2.0)

brent_dekker: Brent-Dekker Root Finding Method

Description

Finding roots of univariate functions in bounded intervals.

Usage

brent_dekker(f, a, b, ..., maxiter = 100, tol = .Machine$double.eps^0.5)

Arguments

f
Function or its name as a string.
a
Left end point of an interval.
b
Right end point of an interval.
maxiter
Maximum number of iterations.
tol
Absolute tolerance.
...
Additional arguments to be passed to f.

Value

  • Brent-Dekker (at the moment) that just returns the root found or NA if the maximum number of iterations has been exceeded..

Details

Well known root finding algorithms for real, univariate, continuous functions. The Brent-Dekker approach is a clever combination of secant and bisection with quadratic interpolation.

References

Quarteroni, A., R. Sacco, and F. Saleri (2007). Numerical Mathematics. Second Edition, Springer-Verlag, Berlin Heidelberg.

See Also

uniroot

Examples

Run this code
# Legendre polynomial of degree 5
lp5 <- c(63, 0, -70, 0, 15, 0)/8
f <- function(x) polyval(lp5, x)
brent_dekker(f, 0.6, 1)  # 0.9061798459 correct to 10 places

Run the code above in your browser using DataLab