bisection {cmna} | R Documentation |
The Bisection Method
Description
Use the bisection method to find real roots
Usage
bisection(f, a, b, tol = 0.001, m = 100)
Arguments
f |
function to locate a root for |
a |
the a bound of the search region |
b |
the b bound of the search region |
tol |
the error tolerance |
m |
the maximum number of iterations |
Details
The bisection method functions by repeatedly halving the interval
between a
and b
and will return when the
interval between them is less than tol
, the error tolerance.
However, this implementation also stops if after m
iterations.
Value
the real root found
See Also
Other optimz:
goldsect
,
gradient
,
hillclimbing()
,
newton()
,
sa()
,
secant()
Examples
f <- function(x) { x^3 - 2 * x^2 - 159 * x - 540}
bisection(f, 0, 10)
[Package cmna version 1.0.5 Index]