Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogNormalDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
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.probability(x0, x1);
    }
    final double denom = shape * SQRT2;
    final double v0 = (FastMath.log(x0) - scale) / denom;
    final double v1 = (FastMath.log(x1) - scale) / denom;
    return 0.5 * Erf.erf(v0, v1);
}
 
Example 2
Source File: Nopol2017_0063_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 3
Source File: Cardumen_00106_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 4
Source File: NormalDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public double probability(double x0,
                          double x1)
    throws NumberIsTooLargeException {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                                            x0, x1, true);
    }
    final double denom = standardDeviation * SQRT2;
    final double v0 = (x0 - mean) / denom;
    final double v1 = (x1 - mean) / denom;
    return 0.5 * Erf.erf(v0, v1);
}
 
Example 5
Source File: Cardumen_00165_s.java    From coming with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x0, double x1)
    throws NumberIsTooLargeException {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                                            x0, x1, true);
    }
    final double denom = standardDeviation * SQRT2;
    final double v0 = (x0 - mean) / denom;
    final double v1 = (x1 - mean) / denom;
    return 0.5 * Erf.erf(v0, v1);
}
 
Example 6
Source File: Cardumen_00212_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 7
Source File: JGenProg2017_00130_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 8
Source File: JGenProg2017_0058_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 9
Source File: Cardumen_00259_t.java    From coming with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x0, double x1)
    throws NumberIsTooLargeException {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                                            x0, x1, true);
    }
    final double denom = standardDeviation * SQRT2;
    final double v0 = (x0 - mean) / denom;
    final double v1 = (x1 - mean) / denom;
    return 0.5 * Erf.erf(v0, v1);
}
 
Example 10
Source File: jMutRepair_008_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 11
Source File: Cardumen_00212_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 12
Source File: Arja_00139_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 13
Source File: JGenProg2017_0088_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 14
Source File: Cardumen_0039_s.java    From coming with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x0, double x1)
    throws NumberIsTooLargeException {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                                            x0, x1, true);
    }
    final double denom = standardDeviation * SQRT2;
    final double v0 = (x0 - mean) / denom;
    final double v1 = (x1 - mean) / denom;
    return 0.5 * Erf.erf(v0, v1);
}
 
Example 15
Source File: Arja_00176_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 16
Source File: NormalDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public double probability(double x0,
                          double x1)
    throws NumberIsTooLargeException {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                                            x0, x1, true);
    }
    final double denom = standardDeviation * SQRT2;
    final double v0 = (x0 - mean) / denom;
    final double v1 = (x1 - mean) / denom;
    return 0.5 * Erf.erf(v0, v1);
}
 
Example 17
Source File: NormalDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x0, double x1)
    throws NumberIsTooLargeException {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                                            x0, x1, true);
    }
    final double denom = standardDeviation * SQRT2;
    final double v0 = (x0 - mean) / denom;
    final double v1 = (x1 - mean) / denom;
    return 0.5 * Erf.erf(v0, v1);
}
 
Example 18
Source File: Arja_00123_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * The default implementation uses the identity
 * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
 */
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
    if (x1 < x0) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 19
Source File: AbstractRealDistribution.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * For a random variable {@code X} whose values are distributed according
 * to this distribution, this method returns {@code P(x0 < X <= x1)}.
 *
 * @param x0 Lower bound (excluded).
 * @param x1 Upper bound (included).
 * @return the probability that a random variable with this distribution
 * takes a value between {@code x0} and {@code x1}, excluding the lower
 * and including the upper endpoint.
 * @throws NumberIsTooLargeException if {@code x0 > x1}.
 *
 * The default implementation uses the identity
 * {@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}
 *
 * @since 3.1
 */
public double probability(double x0,
                          double x1) {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                                            x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}
 
Example 20
Source File: BaseDistribution.java    From nd4j with Apache License 2.0 3 votes vote down vote up
/**
 * For a random variable {@code X} whose values are distributed according
 * to this distribution, this method returns {@code P(x0 < X <= x1)}.
 *
 * @param x0 Lower bound (excluded).
 * @param x1 Upper bound (included).
 * @return the probability that a random variable with this distribution
 * takes a value between {@code x0} and {@code x1}, excluding the lower
 * and including the upper endpoint.
 * @throws org.apache.commons.math3.exception.NumberIsTooLargeException if {@code x0 > x1}.
 *                                                                      <p/>
 *                                                                      The default implementation uses the identity
 *                                                                      {@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}
 * @since 3.1
 */

public double probability(double x0, double x1) {
    if (x0 > x1) {
        throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT, x0, x1, true);
    }
    return cumulativeProbability(x1) - cumulativeProbability(x0);
}