powered by
The secant method for root finding
secant(f, x, tol = 0.001, m = 100)
function to integrate
an initial estimate of the root
the error tolerance
the maximum number of iterations
the real root found
The secant method for root finding extends Newton's method to estimate the derivative. It will return when the interval between them is less than tol, the error tolerance. However, this implementation also stop if after m iterations.
tol
m
Other optimz: bisection(), goldsect, gradient, hillclimbing(), newton(), sa()
bisection()
goldsect
gradient
hillclimbing()
newton()
sa()
# NOT RUN { f <- function(x) { x^3 - 2 * x^2 - 159 * x - 540 } secant(f, 1) # }
Run the code above in your browser using DataLab