Learn R Programming

pracma (version 1.7.0)

brentDekker: Brent-Dekker Root Finding Algorithm

Description

Find root of continuous function of one variable.

Usage

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

Arguments

f
function whose root is to be found.
a, b
left and right end points of an interval; function values need to be of different sign at the endpoints.
maxiter
maximum number of iterations.
tol
relative tolerance.

Value

  • brentDekker returns a list with
  • rootlocation of the root.
  • f.rootfuntion value at the root.
  • f.callsnumber of function calls.
  • estim.precestimated relative precision.

Details

brentDekker implements a version of the Brent-Dekker algorithm, a 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

ridders, newtonRaphson

Examples

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

Run the code above in your browser using DataLab