Learn R Programming

cmna (version 1.0.5)

secant: Secant Method

Description

The secant method for root finding

Usage

secant(f, x, tol = 0.001, m = 100)

Arguments

f

function to integrate

x

an initial estimate of the root

tol

the error tolerance

m

the maximum number of iterations

Value

the real root found

Details

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.

See Also

Other optimz: bisection(), goldsect, gradient, hillclimbing(), newton(), sa()

Examples

Run this code
# 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