unirootDiscrete

0th

Percentile

Identify where a non-increasing function changes sign

Let f be a non-increasing (or non-decreasing) function that changes sign within the interval specified. If 'pos.side'=TRUE (or FALSE) then unirootDiscrete finds the value x such that f(x) is closest to the sign change and is positive (or negative).

Keywords
math
Usage
unirootDiscrete(f, interval, lower = min(interval), upper = max(interval), tol = 10^-5, pos.side = FALSE, print.steps = FALSE, maxiter = 1000, ...)
Arguments
f
function for which a root is needed
interval
an interval giving minimum and maximum allowable values for root
lower
lower bound for root
upper
upper bound for root
tol
absolute tolerance, abs(true root-estimated root)
pos.side
if TRUE finds value x closest to the sign change in f, such that f(x)>0
print.steps
if true prints interations
maxiter
maximum number of iterations
...
additional arguments to f
Details

The algorithm evaluates f(x) iteratively, and the change in 'x' is halved each iteration until the change in 'x' is less than tol. Then the root is returned according to the pos.side parameter.

Value

A list with the folllowing elements,...

Aliases
  • unirootDiscrete
Examples
test<-function(x,parm=10.987654321){ ifelse(x>=parm,1,-1) }
unirootDiscrete(test,lower=0,upper=100,tol=10^-4,pos.side=FALSE,print.steps=TRUE)
Documentation reproduced from package binseqtest, version 1.0.3, License: GPL-3

Community examples

Looks like there are no examples yet.