/** * For a random variable X whose values are distributed according * to this distribution, this method returns P(x0 ≤ X ≤ x1). * <p> * The default implementation uses the identity</p> * <p> * P(x0 ≤ X ≤ x1) = P(X ≤ x1) - P(X ≤ x0) </p> * * @param x0 the (inclusive) lower bound * @param x1 the (inclusive) upper bound * @return the probability that a random variable with this distribution * will take a value between <code>x0</code> and <code>x1</code>, * including the endpoints. * @throws MathException if the cumulative probability can not be * computed due to convergence or other numerical errors. * @throws IllegalArgumentException if <code>x0 > x1</code> */ public double cumulativeProbability(double x0, double x1) throws MathException { if (x0 > x1) { throw new IllegalArgumentException ("lower endpoint must be less than or equal to upper endpoint"); } return cumulativeProbability(x1) - cumulativeProbability(x0); } }
/** * For a random variable X whose values are distributed according * to this distribution, this method returns P(x0 ≤ X ≤ x1). * <p> * The default implementation uses the identity</p> * <p> * P(x0 ≤ X ≤ x1) = P(X ≤ x1) - P(X ≤ x0) </p> * * @param x0 the (inclusive) lower bound * @param x1 the (inclusive) upper bound * @return the probability that a random variable with this distribution * will take a value between <code>x0</code> and <code>x1</code>, * including the endpoints. * @throws MathException if the cumulative probability can not be * computed due to convergence or other numerical errors. * @throws IllegalArgumentException if <code>x0 > x1</code> */ public double cumulativeProbability(double x0, double x1) throws MathException { if (x0 > x1) { throw MathRuntimeException.createIllegalArgumentException( LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT, x0, x1); } return cumulativeProbability(x1) - cumulativeProbability(x0); } }
/** * For a random variable X whose values are distributed according * to this distribution, this method returns P(x0 ≤ X ≤ x1). * <p> * The default implementation uses the identity</p> * <p> * P(x0 ≤ X ≤ x1) = P(X ≤ x1) - P(X ≤ x0) </p> * * @param x0 the (inclusive) lower bound * @param x1 the (inclusive) upper bound * @return the probability that a random variable with this distribution * will take a value between <code>x0</code> and <code>x1</code>, * including the endpoints. * @throws MathException if the cumulative probability can not be * computed due to convergence or other numerical errors. * @throws IllegalArgumentException if <code>x0 > x1</code> */ public double cumulativeProbability(double x0, double x1) throws MathException { if (x0 > x1) { throw MathRuntimeException.createIllegalArgumentException( "lower endpoint ({0}) must be less than or equal to upper endpoint ({1})", x0, x1); } return cumulativeProbability(x1) - cumulativeProbability(x0); } }