Description Usage Arguments Details Value Examples
View source: R/halleys_method.R
Halley's method is an iterative root-finding method with cubic convergence that requires the first and second derivative.
1 | halleys_method(f, fp, fpp, x0, tol = 1e-08)
|
f |
Univariate function to find root of |
fp |
First derivative of |
fpp |
Second derivative of |
x0 |
A point close to the root of |
tol |
Tolerance for convergence. |
Halley's method finds the root of a univariate function f with first derivative f' and second derivative f'' given an initial guess x_0 by the iteration:
x_{n + 1} = x_n - \frac{2f(x_n)f'(x_n)}{2(f'(x_n))^2 - f(x_n)f''(x_n)}
.
The algorithm terminates when:
the algorithm exceeds 1000 iterations,
the value of f, f', or f'' is non-finite for an iterate (x_n),
the iterate (x_n) becomes non-finite, or
the algorithm converges and |f(x_{n}) - f(x_{n + 1})| < tol.
A root of f
near x0
. If the algorithm does not
converge, NA
is returned.
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.