rootwrap: zeroin: Find a single root of a function of one variable...

Description Usage Arguments Details Value References See Also Examples

View source: R/rootwrap.R

Description

Find a single root of a function of one variable within a specified interval. Brent's method.

Usage

1
2
   rootwrap(fn=fn, gr=NULL, ri=NULL, method="uniroot", ftrace=TRUE, ...)
   rwx(fn=fn, gr=NULL, ri=NULL, method="uniroot", ftrace=TRUE, ...)

Arguments

fn

A real function of a single variable for which a root is desired.

gr

A real function of a single variable giving the gradient (derivative) of fn.

ri

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

method

A character string giving the name of the rootfinding method to be used. Must be one of the methods rootwrap supports. See the source code.

ftrace

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

...

Extra data needed to compute the function f.

Details

This routine is a wrapper to allow a consistent calling sequence for a number of different rootfiners.

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
 6
 7
 8
 9
10
# Dekker example
# require(rootoned)
# phi <- 6
dek <- function(x, phi=0){ 1/(x-3) - phi }
# r1 <- rootwrap(dek, ri=c(3.0000001, 6), ftrace=TRUE, method="uniroot", phi=6)
r1 <- rwx(dek, ri=c(3.0000001, 6), ftrace=TRUE, method="uniroot", phi=6)
r1
# r2 <- rootwrap(dek, ri=c(3.0000001, 6), ftrace=TRUE, method="root1d", phi=6)
r2 <- rwx(dek, ri=c(3.0000001, 6), ftrace=TRUE, method="root1d", phi=6)
r2

rootoned documentation built on Aug. 29, 2018, 3 a.m.