Bisect {CooccurrenceAffinity} | R Documentation |
Find a root of a function by the method of Bisections
Bisect(ffnc, intrv, tol = 1e-08)
ffnc |
an increasing function of a single scalar argument |
intrv |
an interval over which the root of ffnc is sought |
tol |
a tolerance determining when the successive bisections of the interval within which the root will lie have become small enough to stop |
This function finds the root of the increasing function ffnc over the scalar interval intrv by the Method of Bisections. The function must be increasing but need not be smooth, and it must have a negative sign (value less than -tol) at the left endpoint of intrv and positive sign (value greater than tol) at the right endpoint. The method of Bisection is used in successive iterations to successively halve the width of the interval in which the root lies.
This function returns a vector consisting of two numbers. The first named root is an estimate of the root x solving ffnc(x) = 0, valid within an error of tol. The second output vector element named fval is the value of the function ffnc at root. It should be very close to 0 unless the function happens to jump from a value less than 0 to a value greater than 0 at root.
Eric Slud
to be added
Bisect(function(x) x^2-1, c(0,2),1e-8)