powered by
newtonraphson(ftn, x0, tol = 1e-09, max.iter = 100)
fixedpoint
bisection
ftn4 <- function(x) { # returns function value and its derivative at x fx <- log(x) - exp(-x) dfx <- 1/x + exp(-x) return(c(fx, dfx)) } newtonraphson(ftn4, 2, 1e-6)
Run the code above in your browser using DataLab