1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.math.distribution;
17
18 import org.apache.commons.math.MathException;
19
20 /**
21 * Base interface for probability distributions.
22 *
23 * @version $Revision: 155427 $ $Date: 2005-02-26 06:11:52 -0700 (Sat, 26 Feb 2005) $
24 */
25 public interface Distribution {
26 /**
27 * For a random variable X whose values are distributed according
28 * to this distribution, this method returns P(X ≤ x). In other words,
29 * this method represents the (cumulative) distribution function, or
30 * CDF, for this distribution.
31 *
32 * @param x the value at which the distribution function is evaluated.
33 * @return the probability that a random variable with this
34 * distribution takes a value less than or equal to <code>x</code>
35 * @throws MathException if the cumulative probability can not be
36 * computed due to convergence or other numerical errors.
37 */
38 double cumulativeProbability(double x) throws MathException;
39
40 /**
41 * For a random variable X whose values are distributed according
42 * to this distribution, this method returns P(x0 ≤ X ≤ x1).
43 *
44 * @param x0 the (inclusive) lower bound
45 * @param x1 the (inclusive) upper bound
46 * @return the probability that a random variable with this distribution
47 * will take a value between <code>x0</code> and <code>x1</code>,
48 * including the endpoints
49 * @throws MathException if the cumulative probability can not be
50 * computed due to convergence or other numerical errors.
51 * @throws IllegalArgumentException if <code>x0 > x1</code>
52 */
53 double cumulativeProbability(double x0, double x1) throws MathException;
54 }