Java Code Examples for org.apache.commons.math.util.FastMath#tan()

The following examples show how to use org.apache.commons.math.util.FastMath#tan() . 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: CauchyDistributionImpl.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * For this distribution, X, this method returns the critical point x, such
 * that P(X &lt; x) = <code>p</code>.
 * <p>
 * Returns <code>Double.NEGATIVE_INFINITY</code> for p=0 and
 * <code>Double.POSITIVE_INFINITY</code> for p=1.</p>
 *
 * @param p the desired probability
 * @return x, such that P(X &lt; x) = <code>p</code>
 * @throws IllegalArgumentException if <code>p</code> is not a valid
 *         probability.
 */
@Override
public double inverseCumulativeProbability(double p) {
    double ret;
    if (p < 0.0 || p > 1.0) {
        throw MathRuntimeException.createIllegalArgumentException(
              LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
    } else if (p == 0) {
        ret = Double.NEGATIVE_INFINITY;
    } else  if (p == 1) {
        ret = Double.POSITIVE_INFINITY;
    } else {
        ret = median + scale * FastMath.tan(FastMath.PI * (p - .5));
    }
    return ret;
}
 
Example 2
Source File: CauchyDistributionImpl.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * For this distribution, {@code X}, this method returns the critical
 * point {@code x}, such that {@code P(X < x) = p}.
 * It will return {@code Double.NEGATIVE_INFINITY} when p = 0 and
 * {@code Double.POSITIVE_INFINITY} when p = 1.
 *
 * @param p Desired probability.
 * @return {@code x}, such that {@code P(X < x) = p}.
 * @throws OutOfRangeException if {@code p} is not a valid probability.
 */
@Override
public double inverseCumulativeProbability(double p) {
    double ret;
    if (p < 0 || p > 1) {
        throw new OutOfRangeException(p, 0, 1);
    } else if (p == 0) {
        ret = Double.NEGATIVE_INFINITY;
    } else  if (p == 1) {
        ret = Double.POSITIVE_INFINITY;
    } else {
        ret = median + scale * FastMath.tan(FastMath.PI * (p - .5));
    }
    return ret;
}
 
Example 3
Source File: ArrayRealVector.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public RealVector mapTanToSelf() {
    for (int i = 0; i < data.length; i++) {
        data[i] = FastMath.tan(data[i]);
    }
    return this;
}
 
Example 4
Source File: CauchyDistributionImpl.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * For this distribution, {@code X}, this method returns the critical
 * point {@code x}, such that {@code P(X < x) = p}.
 * It will return {@code Double.NEGATIVE_INFINITY} when p = 0 and
 * {@code Double.POSITIVE_INFINITY} when p = 1.
 *
 * @param p Desired probability.
 * @return {@code x}, such that {@code P(X < x) = p}.
 * @throws OutOfRangeException if {@code p} is not a valid probability.
 */
@Override
public double inverseCumulativeProbability(double p) {
    double ret;
    if (p < 0 || p > 1) {
        throw new OutOfRangeException(p, 0, 1);
    } else if (p == 0) {
        ret = Double.NEGATIVE_INFINITY;
    } else  if (p == 1) {
        ret = Double.POSITIVE_INFINITY;
    } else {
        ret = median + scale * FastMath.tan(FastMath.PI * (p - .5));
    }
    return ret;
}
 
Example 5
Source File: CauchyDistributionImpl.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * For this distribution, {@code X}, this method returns the critical
 * point {@code x}, such that {@code P(X < x) = p}.
 * It will return {@code Double.NEGATIVE_INFINITY} when p = 0 and
 * {@code Double.POSITIVE_INFINITY} when p = 1.
 *
 * @param p Desired probability.
 * @return {@code x}, such that {@code P(X < x) = p}.
 * @throws OutOfRangeException if {@code p} is not a valid probability.
 */
@Override
public double inverseCumulativeProbability(double p) {
    double ret;
    if (p < 0 || p > 1) {
        throw new OutOfRangeException(p, 0, 1);
    } else if (p == 0) {
        ret = Double.NEGATIVE_INFINITY;
    } else  if (p == 1) {
        ret = Double.POSITIVE_INFINITY;
    } else {
        ret = median + scale * FastMath.tan(FastMath.PI * (p - .5));
    }
    return ret;
}
 
Example 6
Source File: Tan.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.tan(x);
}
 
Example 7
Source File: ComposableFunction.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public double value(double d) {
    return FastMath.tan(d);
}
 
Example 8
Source File: Tan.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.tan(x);
}
 
Example 9
Source File: Tan.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.tan(x);
}