root1d: root1d: Find a single root of a function of one variable...

Description Usage Arguments Details Value References See Also Examples

Description

Find a single root of a function of one variable within a specified interval.

Usage

1
   root1d(f, interval, tol = .Machine$double.eps^0.5, maxiter = 1000, trace=FALSE, ...) 

Arguments

f

A real function of a single variable.

interval

A vector of two real numbers defining the ends of the interval in which to search.

tol

A tolerance for the root. When the interval within which a root exists is smaller than tol, root1d will terminate.

maxiter

A limit on the number of function evaluations permitted in the attempt to find a root.

trace

If TRUE, provided diagnostic output of the process of rootfinding.

...

Extra data needed to compute the function f.

Details

This routine is an all-R translation of Algorithm 18 of Nash (1979). This is a variant of the Dekker-Brent approach. At the time it was written, the goal was to produce a very short code that was robust in a low-precision environment.

Value

The output is a list consisting of

References

Nash, John C. (1979) Compact numerical methods: linear algebra and function minimisation. Bristol UK: Adam Hilger.

See Also

optimize

Examples

1
2
3
4
5
# Dekker example
# require(rootoned)
dek <- function(x){ 1/(x-3) - 6 }
r1 <- root1d(dek, c(3.0000001, 6), trace=TRUE)
r1

rootoned documentation built on May 2, 2019, 6:48 p.m.