List of usage examples for org.apache.commons.math.analysis.solvers NewtonSolver NewtonSolver
@Deprecated
public NewtonSolver(DifferentiableUnivariateRealFunction f)
From source file:dr.math.distributions.KernelDensityEstimatorDistribution.java
/** * quantile (inverse cumulative density function) of the distribution * * @param y argument//from ww w . j a v a2 s . c o m * @return cdf value */ public double quantile(final double y) { final DifferentiableUnivariateRealFunction root = new DifferentiableUnivariateRealFunction() { @Override public UnivariateRealFunction derivative() { return pdfFunction; } @Override public double value(double x) throws FunctionEvaluationException { return cdfFunction.value(x) - y; } }; NewtonSolver solver = new NewtonSolver(root); double q; try { q = solver.solve(getFromPoint(), getToPoint()); } catch (MaxIterationsExceededException e) { throw new RuntimeException(e.getMessage()); } catch (FunctionEvaluationException e) { throw new RuntimeException(e.getMessage()); } return q; }