Created new method "probability(double,double)" in implementations were
it it overridden, and deprecated "cumulativeProbability(double,double)".


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1369415 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2012-08-04 19:24:56 +00:00
parent 5396f1e119
commit ef205a5d1a
2 changed files with 27 additions and 3 deletions

View File

@ -201,16 +201,28 @@ public class LogNormalDistribution extends AbstractRealDistribution {
return 0.5 + 0.5 * Erf.erf(dev / (shape * SQRT2));
}
/**
* {@inheritDoc}
*
* @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
*/
@Override@Deprecated
public double cumulativeProbability(double x0, double x1)
throws NumberIsTooLargeException {
return probability(x0, x1);
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x0, double x1)
public double probability(double x0,
double x1)
throws NumberIsTooLargeException {
if (x0 > x1) {
throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
x0, x1, true);
}
if (x0 <= 0 || x1 <= 0) {
return super.cumulativeProbability(x0, x1);
return super.probability(x0, x1);
}
final double denom = shape * SQRT2;
final double v0 = (FastMath.log(x0) - scale) / denom;

View File

@ -152,9 +152,21 @@ public class NormalDistribution extends AbstractRealDistribution {
return 0.5 * (1 + Erf.erf(dev / (standardDeviation * SQRT2)));
}
/**
* {@inheritDoc}
*
* @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
*/
@Override@Deprecated
public double cumulativeProbability(double x0, double x1)
throws NumberIsTooLargeException {
return probability(x0, x1);
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x0, double x1)
public double probability(double x0,
double x1)
throws NumberIsTooLargeException {
if (x0 > x1) {
throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,