secant: Secant Method

Description Usage Arguments Details Value See Also Examples

View source: R/secant.R

Description

The secant method for root finding

Usage

1
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

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.

Value

the real root found

See Also

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

Examples

1
2
f <- function(x) { x^3 - 2 * x^2 - 159 * x - 540 }
secant(f, 1)


cmna documentation built on May 19, 2017, 4:26 p.m.
Search within the cmna package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.