unirootDiscrete: Identify where a non-increasing function changes sign
Description
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).
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)<= tol
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
Author
M.P. Fay
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.