mirror of
https://github.com/apache/commons-math.git
synced 2025-02-07 18:49:40 +00:00
MATH-839
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:
parent
5396f1e119
commit
ef205a5d1a
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user