Posts Tagged ‘ secant ’

Finding roots of functions in actuarial science

December 7, 2010
By
Finding roots of functions in actuarial science

The following simple code can be used to find roots of functions (based on the secant algorithm), secant=function(fun, x0, x1, tolerence=1e-07, niter=500){for ( i in 1:niter ) { x2 <- x1-fun(x1)*(x1-x0)/(fun(x1)-fun(x0)) if (abs(fun(x2)) < to...

Read more »