001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.commons.math3.analysis.solvers;
019
020
021 /** The kinds of solutions that a {@link BracketedUnivariateSolver
022 * (bracketed univariate real) root-finding algorithm} may accept as solutions.
023 * This basically controls whether or not under-approximations and
024 * over-approximations are allowed.
025 *
026 * <p>If all solutions are accepted ({@link #ANY_SIDE}), then the solution
027 * that the root-finding algorithm returns for a given root may be equal to the
028 * actual root, but it may also be an approximation that is slightly smaller
029 * or slightly larger than the actual root. Root-finding algorithms generally
030 * only guarantee that the returned solution is within the requested
031 * tolerances. In certain cases however, in particular for
032 * {@link org.apache.commons.math3.ode.events.EventHandler state events} of
033 * {@link org.apache.commons.math3.ode.ODEIntegrator ODE solvers}, it
034 * may be necessary to guarantee that a solution is returned that lies on a
035 * specific side the solution.</p>
036 *
037 * @see BracketedUnivariateSolver
038 * @since 3.0
039 * @version $Id: AllowedSolution.java 1364387 2012-07-22 18:14:11Z tn $
040 */
041 public enum AllowedSolution {
042 /** There are no additional side restriction on the solutions for
043 * root-finding. That is, both under-approximations and over-approximations
044 * are allowed. So, if a function f(x) has a root at x = x0, then the
045 * root-finding result s may be smaller than x0, equal to x0, or greater
046 * than x0.
047 */
048 ANY_SIDE,
049
050 /** Only solutions that are less than or equal to the actual root are
051 * acceptable as solutions for root-finding. In other words,
052 * over-approximations are not allowed. So, if a function f(x) has a root
053 * at x = x0, then the root-finding result s must satisfy s <= x0.
054 */
055 LEFT_SIDE,
056
057 /** Only solutions that are greater than or equal to the actual root are
058 * acceptable as solutions for root-finding. In other words,
059 * under-approximations are not allowed. So, if a function f(x) has a root
060 * at x = x0, then the root-finding result s must satisfy s >= x0.
061 */
062 RIGHT_SIDE,
063
064 /** Only solutions for which values are less than or equal to zero are
065 * acceptable as solutions for root-finding. So, if a function f(x) has
066 * a root at x = x0, then the root-finding result s must satisfy f(s) <= 0.
067 */
068 BELOW_SIDE,
069
070 /** Only solutions for which values are greater than or equal to zero are
071 * acceptable as solutions for root-finding. So, if a function f(x) has
072 * a root at x = x0, then the root-finding result s must satisfy f(s) >= 0.
073 */
074 ABOVE_SIDE;
075
076 }