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

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION . 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: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example 2
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example 3
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example 4
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example 5
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example 6
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example 7
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example 8
Source File: AdaptiveStepsizeIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                FastMath.abs(h), minStep, true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}