List of usage examples for org.apache.commons.math.distribution PascalDistribution inverseCumulativeProbability
int inverseCumulativeProbability(double p) throws MathException;
From source file:geogebra.kernel.statistics.AlgoInversePascal.java
protected final void compute() { if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) { int param = (int) Math.round(a.getDouble()); double param2 = b.getDouble(); double val = c.getDouble(); try {//from w w w . jav a 2 s . c om PascalDistribution dist = getPascalDistribution(param, param2); double result = dist.inverseCumulativeProbability(val); // eg InversePascal[1,1,1] returns 2147483647 if (result >= Integer.MAX_VALUE) num.setValue(param); else num.setValue(result + 1); } catch (Exception e) { num.setUndefined(); } } else num.setUndefined(); }
From source file:geogebra.common.kernel.statistics.AlgoInversePascal.java
@Override public final void compute() { if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) { int param = (int) Math.round(a.getDouble()); double param2 = b.getDouble(); double val = c.getDouble(); try {/*from w ww .j a va2 s. c o m*/ PascalDistribution dist = getPascalDistribution(param, param2); double result = dist.inverseCumulativeProbability(val); // eg InversePascal[1,1,1] returns 2147483647 if (result >= Integer.MAX_VALUE) num.setValue(param); else num.setValue(result + 1); } catch (Exception e) { num.setUndefined(); } } else num.setUndefined(); }