Examples of MathException


Examples of org.apache.commons.math.MathException

    private static void checkAllFiniteReal(final double[] values, final String pattern)
        throws MathException {
        for (int i = 0; i < values.length; i++) {
            final double x = values[i];
            if (Double.isInfinite(x) || Double.isNaN(x)) {
                throw new MathException(pattern, i, x);
            }
        }
    }
View Full Code Here

Examples of org.apache.commons.math.MathException

     */
    private static void checkStrictlyIncreasing(final double[] xval)
        throws MathException {
        for (int i = 0; i < xval.length; ++i) {
            if (i >= 1 && xval[i - 1] >= xval[i]) {
                throw new MathException(
                        "the abscissae array must be sorted in a strictly " +
                        "increasing order, but the {0}-th element is {1} " +
                        "whereas {2}-th is {3}",
                        i - 1, xval[i - 1], i, xval[i]);
            }
View Full Code Here

Examples of org.apache.commons.math.MathException

     * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html"/>
     */
    public double transform(Object o) throws MathException{

        if (o == null) {
            throw new MathException("Conversion Exception in Transformation, Object is null");
        }

        if (o instanceof Number) {
            return ((Number)o).doubleValue();
        }

        try {
            return Double.valueOf(o.toString()).doubleValue();
        } catch (NumberFormatException e) {
            throw new MathException(e,
                                    "Conversion Exception in Transformation: {0}", e.getMessage());
        }
    }
View Full Code Here

Examples of org.apache.commons.math.MathException

            }
            if (Math.abs(rootFindingFunction.value(upperBound)) < getSolverAbsoluteAccuracy()) {
                return upperBound;
            }
            // Failed bracket convergence was not because of corner solution
            throw new MathException(ex);
        }

        // find root
        double root = UnivariateRealSolverUtils.solve(rootFindingFunction,
                // override getSolverAbsoluteAccuracy() to use a Brent solver with
View Full Code Here

Examples of org.apache.commons.math.MathException

     * @see org.apache.commons.collections.Transformer#transform(java.lang.Object)
     */
    public double transform(Object o) throws MathException{

        if (o == null) {
            throw new MathException("Conversion Exception in Transformation, Object is null", new Object[0]);
        }

        if (o instanceof Number) {
            return ((Number)o).doubleValue();
        }
           
        try {
            return new Double(o.toString()).doubleValue();
        } catch (Exception e) {
            throw new MathException("Conversion Exception in Transformation: {0}",
                                    new Object[] { e.getMessage() }, e);
        }
    }
View Full Code Here

Examples of org.apache.commons.math.MathException

            }
            if (Math.abs(rootFindingFunction.value(upperBound)) < 1E-6) {
                return upperBound;
            }    
            // Failed bracket convergence was not because of corner solution
            throw new MathException(ex);
        }

        // find root
        double root = UnivariateRealSolverUtils.solve(rootFindingFunction,
                bracket[0],bracket[1]);
View Full Code Here

Examples of org.apache.velocity.exception.MathException

            String msg = "Right side of modulus operation is zero. Must be non-zero. "
                        + getLocation(context);
            if (strictMode)
            {
                log.error(msg);
                throw new MathException(msg);
            }
            else
            {
                log.debug(msg);
                return null;
View Full Code Here

Examples of org.apache.velocity.exception.MathException

            String msg = "Right side of division operation is zero. Must be non-zero. "
                          + getLocation(context);
            if (strictMode)
            {
                log.error(msg);
                throw new MathException(msg);
            }
            else
            {
                log.debug(msg);
                return null;
View Full Code Here

Examples of org.apache.velocity.exception.MathException

                        + (wrongtype ? "is not a Number. " : "has a null value. ")
                        + getLocation(context);
            if (strictMode)
            {
                log.error(msg);
                throw new MathException(msg);
            }
            else
            {
                log.debug(msg);
                return null;
View Full Code Here

Examples of org.apache.velocity.exception.MathException

            String msg = "Right side of modulus operation is zero. Must be non-zero. "
                        + getLocation(context);
            if (strictMode)
            {
                log.error(msg);
                throw new MathException(msg);
            }
            else
            {
                log.debug(msg);
                return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.