Example usage for org.apache.commons.math.distribution ZipfDistribution inverseCumulativeProbability

List of usage examples for org.apache.commons.math.distribution ZipfDistribution inverseCumulativeProbability

Introduction

In this page you can find the example usage for org.apache.commons.math.distribution ZipfDistribution inverseCumulativeProbability.

Prototype

int inverseCumulativeProbability(double p) throws MathException;

Source Link

Document

For this distribution, X, this method returns the largest x such that P(X ≤ x) <= p.

Usage

From source file:geogebra.kernel.statistics.AlgoInverseZipf.java

protected final void compute() {

    if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) {
        int param = (int) a.getDouble();
        double param2 = b.getDouble();
        double val = c.getDouble();
        try {//from  ww  w  .  j  a  v  a  2 s .  com
            ZipfDistribution dist = getZipfDistribution(param, param2);
            num.setValue(dist.inverseCumulativeProbability(val) + 1);

        } catch (Exception e) {
            num.setUndefined();
        }
    } else
        num.setUndefined();
}

From source file:geogebra.common.kernel.statistics.AlgoInverseZipf.java

@Override
public final void compute() {

    if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) {
        int param = (int) a.getDouble();
        double param2 = b.getDouble();
        double val = c.getDouble();
        try {/* w  ww .j a  va 2s  . com*/
            ZipfDistribution dist = getZipfDistribution(param, param2);
            num.setValue(dist.inverseCumulativeProbability(val) + 1);

        } catch (Exception e) {
            num.setUndefined();
        }
    } else
        num.setUndefined();
}