/** * Check that the endpoints specify an interval. * * @param lower Lower endpoint. * @param upper Upper endpoint. * @throws NumberIsTooLargeException if {@code lower >= upper}. */ protected void verifyInterval(final double lower, final double upper) throws NumberIsTooLargeException { UnivariateSolverUtils.verifyInterval(lower, upper); }
/** * Check that {@code lower < initial < upper}. * * @param lower Lower endpoint. * @param initial Initial value. * @param upper Upper endpoint. * @throws NumberIsTooLargeException if {@code lower >= initial} or * {@code initial >= upper}. */ public static void verifySequence(final double lower, final double initial, final double upper) throws NumberIsTooLargeException { verifyInterval(lower, initial); verifyInterval(initial, upper); }
/** * Prepare for computation. * Subclasses must call this method if they override any of the * {@code solve} methods. * * @param maxEval Maximum number of evaluations. * @param f the integrand function * @param lower the min bound for the interval * @param upper the upper bound for the interval * @throws NullArgumentException if {@code f} is {@code null}. * @throws MathIllegalArgumentException if {@code min >= max}. */ protected void setup(final int maxEval, final UnivariateFunction f, final double lower, final double upper) throws NullArgumentException, MathIllegalArgumentException { // Checks. MathUtils.checkNotNull(f); UnivariateSolverUtils.verifyInterval(lower, upper); // Reset. min = lower; max = upper; function = f; evaluations = evaluations.withMaximalCount(maxEval).withStart(0); count = count.withStart(0); }
/** * Check that the endpoints specify an interval and the end points * bracket a root. * * @param function Function. * @param lower Lower endpoint. * @param upper Upper endpoint. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static void verifyBracketing(UnivariateFunction function, final double lower, final double upper) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } verifyInterval(lower, upper); if (!isBracketing(function, lower, upper)) { throw new NoBracketingException(lower, upper, function.value(lower), function.value(upper)); } } }
/** * Check that the endpoints specify an interval. * * @param lower Lower endpoint. * @param upper Upper endpoint. * @throws NumberIsTooLargeException if {@code lower >= upper}. */ protected void verifyInterval(final double lower, final double upper) throws NumberIsTooLargeException { UnivariateSolverUtils.verifyInterval(lower, upper); }
/** * Check that the endpoints specify an interval. * * @param lower Lower endpoint. * @param upper Upper endpoint. * @throws NumberIsTooLargeException if {@code lower >= upper}. */ protected void verifyInterval(final double lower, final double upper) throws NumberIsTooLargeException { UnivariateSolverUtils.verifyInterval(lower, upper); }
/** * Check that {@code lower < initial < upper}. * * @param lower Lower endpoint. * @param initial Initial value. * @param upper Upper endpoint. * @throws NumberIsTooLargeException if {@code lower >= initial} or * {@code initial >= upper}. */ public static void verifySequence(final double lower, final double initial, final double upper) throws NumberIsTooLargeException { verifyInterval(lower, initial); verifyInterval(initial, upper); }
/** * Check that {@code lower < initial < upper}. * * @param lower Lower endpoint. * @param initial Initial value. * @param upper Upper endpoint. * @throws NumberIsTooLargeException if {@code lower >= initial} or * {@code initial >= upper}. */ public static void verifySequence(final double lower, final double initial, final double upper) throws NumberIsTooLargeException { verifyInterval(lower, initial); verifyInterval(initial, upper); }
/** * Prepare for computation. * Subclasses must call this method if they override any of the * {@code solve} methods. * * @param maxEval Maximum number of evaluations. * @param f the integrand function * @param lower the min bound for the interval * @param upper the upper bound for the interval * @throws NullArgumentException if {@code f} is {@code null}. * @throws MathIllegalArgumentException if {@code min >= max}. */ protected void setup(final int maxEval, final UnivariateFunction f, final double lower, final double upper) throws NullArgumentException, MathIllegalArgumentException { // Checks. MathUtils.checkNotNull(f); UnivariateSolverUtils.verifyInterval(lower, upper); // Reset. min = lower; max = upper; function = f; evaluations = evaluations.withMaximalCount(maxEval).withStart(0); count = count.withStart(0); }
/** * Prepare for computation. * Subclasses must call this method if they override any of the * {@code solve} methods. * * @param maxEval Maximum number of evaluations. * @param f the integrand function * @param lower the min bound for the interval * @param upper the upper bound for the interval * @throws NullArgumentException if {@code f} is {@code null}. * @throws MathIllegalArgumentException if {@code min >= max}. */ protected void setup(final int maxEval, final UnivariateFunction f, final double lower, final double upper) throws NullArgumentException, MathIllegalArgumentException { // Checks. MathUtils.checkNotNull(f); UnivariateSolverUtils.verifyInterval(lower, upper); // Reset. min = lower; max = upper; function = f; evaluations = evaluations.withMaximalCount(maxEval).withStart(0); count = count.withStart(0); }
/** * Check that the endpoints specify an interval and the end points * bracket a root. * * @param function Function. * @param lower Lower endpoint. * @param upper Upper endpoint. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static void verifyBracketing(UnivariateFunction function, final double lower, final double upper) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } verifyInterval(lower, upper); if (!isBracketing(function, lower, upper)) { throw new NoBracketingException(lower, upper, function.value(lower), function.value(upper)); } } }
/** * Check that the endpoints specify an interval and the end points * bracket a root. * * @param function Function. * @param lower Lower endpoint. * @param upper Upper endpoint. * @throws NoBracketingException if the function has the same sign at the * endpoints. * @throws NullArgumentException if {@code function} is {@code null}. */ public static void verifyBracketing(UnivariateFunction function, final double lower, final double upper) throws NullArgumentException, NoBracketingException { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } verifyInterval(lower, upper); if (!isBracketing(function, lower, upper)) { throw new NoBracketingException(lower, upper, function.value(lower), function.value(upper)); } } }