Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

brentdekker

Brent-Dekker Root Finding Algorithm


Description

Find root of continuous function of one variable.

Usage

brentDekker(fun, a, b, maxiter = 500, tol = 1e-12, ...)
brent(fun, a, b, maxiter = 500, tol = 1e-12, ...)

Arguments

fun

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.

...

additional arguments to be passed to the function.

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.

brent is simply an alias for brentDekker.

Value

brent returns a list with

root

location of the root.

f.root

funtion value at the root.

f.calls

number of function calls.

estim.prec

estimated relative precision.

References

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

See Also

Examples

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

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.