For a function $f(x)$, the Taylor series expansion is given by: $$ \begin{align*} f(x + \delta) \approx f(x) + f'(x)\delta + \frac{f''(x)}{2}\delta^2 + \cdots \end{align*} $$ As delta approaches zero (and if the function is well-behaved), this gives $$ \begin{align*} \delta = -\frac{f(x)}{f'(x)} \end{align*} $$ when $f(x + \delta) = 0$.
There are several well-known problems with Newton's method, in particular when the range of values given includes a local maximum or minimum. In this situation, the next iterative step can shoot off to $\pm\infty$. This implementation currently does not attempt to correct for this: if the value of $x$ goes beyond the initial range of values $x_{low}$ and $x_{high}$, an exception is thrown.
If the function that is provided does not override the {@link com.opengamma.analytics.math.function.DoubleFunction1D#derivative()} method, then the derivative is approximated using finite difference. This is undesirable for several reasons: (i) the extra function evaluations will lead to slower convergence; and (ii) the choice of shift size is very important (too small and the result will be dominated by rounding errors, too large and convergence will be even slower). Use of another root-finder is recommended in this case.
|
|