Search in sources :

Example 1 with Differentiator

use of de.lab4inf.math.differentiation.Differentiator in project symja_android_library by axkr.

the class NewtonRootFinder method modnewton.

/**
 * Modified Newton method for multiple roots.
 *
 * @param fct the function to find the root of
 * @param dF the first derivative of the function
 * @param x0 the initial guess as starting value
 * @param eps the accuracy to reach
 * @return the root
 */
public static double modnewton(final Function fct, final Function dF, final double x0, final double eps) {
    Function d2F;
    if (dF instanceof Differentiable) {
        d2F = ((Differentiable) dF).getDerivative();
    } else {
        getLogger().warn(NO_DERIVATIVE_NOT_RECOMMENDED);
        d2F = new Differentiator(dF);
    }
    return modnewton(fct, dF, d2F, x0, eps);
}
Also used : Function(de.lab4inf.math.Function) Differentiable(de.lab4inf.math.Differentiable) Differentiator(de.lab4inf.math.differentiation.Differentiator)

Aggregations

Differentiable (de.lab4inf.math.Differentiable)1 Function (de.lab4inf.math.Function)1 Differentiator (de.lab4inf.math.differentiation.Differentiator)1