zbrent: Van Wijngaarden-Decker-Brent Root-finding Algorithm

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/zbrent.R

Description

The function zbrent searches the interval int for a root, i.e., a zero, with respect to the first argument of a one-dimensional user-supplied function func.

Usage

1
   zbrent(func,int,tol)

Arguments

func

the function for which the root is sought

int

a vector representing the interval in which the required root is located

tol

the desired accuracy (convergence tolerance)

Details

The values of func at the two endpoints of int must have opposite signs.

Value

The algorithm returns the required root unless there is none, or the algorithm exceeds 100 iterations. In the latter case, an error message is displayed, and the current approximation is returned.

Author(s)

David E. Matthews dematthews@uwaterloo.ca

References

Press W.H., Flannery B.P., Teukolsky S.A., Vetterling W.T. (1988) Numerical Recipes: The Art of Scientific Computing. Cambridge: Cambridge University Press.

See Also

confband, exact

Examples

1
2
3
4
f<-function(x) x*(x^2-1)+0.5
x<-seq(-2,2,length=100)
plot(x,f(x),type="l")
zbrent(f,c(-2,2),1.0e-10)

Example output

Loading required package: survival
[1] -1.191488

kmconfband documentation built on May 2, 2019, 2:49 p.m.