Description Usage Arguments Value References
The function newton.raphson.root
is a general root finder which
can find the zero of any function whose derivative is available.
In this package, it is called by irr.solve
and by
GenBSImplied
. It can be used in other situations as
well - see the examples below.
1 2 3 4 5 6 7 8 9 | newton.raphson.root(
f,
guess = 0,
lower = -Inf,
upper = Inf,
max.iter = 100,
toler = 1e-06,
convergence = 1e-08
)
|
f |
The function whose zero is to be found. An R function object that takes one numeric argument and returns a list of two components (value and gradient). In an IRR application, these two components will be the NPV and the DV01/10000. In an implied volatility application, the components will be the option price and the vega. See also the examples below |
guess |
The starting value (guess) from which the solver starts searching for the IRR |
lower |
The lower end of the interval within which to search for the root |
upper |
The upper end of the interval within which to search for the root |
max.iter |
The maximum number of iterations of the Newton-Raphson procedure |
toler |
The criterion to determine whether a zero has been
found. If the value of the function exceeds |
convergence |
The relative tolerance threshold used to
determine whether the Newton-Raphson procedure has
converged. The procedure terminates when the last step is less
than |
The function returns NA
under either of two conditions: (a)
the procedure did not converge after max.iter
iterations,
or (b) the procedure converged but the function value is not zero
within the limits of toler
at this point. The second
condition usually implies that the procedure has converged to a
non zero local minimum from which there is no downhill gradient.
If the iterations converge to a genuine root (within the limits of
toler
), then it returns the root that was found.
The Newton Raphson solver was converted from C++ code in the Boost library
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.