commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1042324 - /commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/
Date Sun, 05 Dec 2010 11:56:42 GMT
Author: erans
Date: Sun Dec  5 11:56:41 2010
New Revision: 1042324

URL: http://svn.apache.org/viewvc?rev=1042324&view=rev
Log:
MATH-451
Deprecation.

Modified:
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
Sun Dec  5 11:56:41 2010
@@ -67,13 +67,34 @@ public class BisectionSolver extends Uni
         return solve(f, min, max);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     * @deprecated in 2.2 (to be removed in 3.0).
+     */
     public double solve(final UnivariateRealFunction f, double min, double max, double initial)
         throws MaxIterationsExceededException, MathUserException {
         return solve(f, min, max);
     }
 
     /** {@inheritDoc} */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f, double min, double max,
double initial)
+        throws MaxIterationsExceededException, MathUserException {
+        return solve(maxEval, f, min, max);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f, double min, double max)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max);
+    }
+
+    /**
+     * {@inheritDoc}
+     * @deprecated in 2.2 (to be removed in 3.0).
+     */
     public double solve(final UnivariateRealFunction f, double min, double max)
         throws MaxIterationsExceededException, MathUserException {
 

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
Sun Dec  5 11:56:41 2010
@@ -64,7 +64,9 @@ public class BrentSolver extends Univari
 
     /**
      * Construct a solver with default properties.
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public BrentSolver() {
         super(DEFAULT_MAXIMUM_ITERATIONS, DEFAULT_ABSOLUTE_ACCURACY);
     }
@@ -121,7 +123,9 @@ public class BrentSolver extends Univari
      * @throws MathUserException if an error occurs evaluating  the function
      * @throws IllegalArgumentException if initial is not between min and max
      * (even if it <em>is</em> a root)
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max, final double initial)
         throws MaxIterationsExceededException, MathUserException {
@@ -170,6 +174,33 @@ public class BrentSolver extends Univari
     }
 
     /**
+     * Find a zero in the given interval with an initial guess.
+     * <p>Throws <code>IllegalArgumentException</code> if the values of
the
+     * function at the three points have the same sign (note that it is
+     * allowed to have endpoints with the same sign if the initial point has
+     * opposite sign function-wise).</p>
+     *
+     * @param f function to solve.
+     * @param min the lower bound for the interval.
+     * @param max the upper bound for the interval.
+     * @param initial the start value to use (must be set to min if no
+     * initial point is known).
+     * @param maxEval Maximum number of evaluations.
+     * @return the value where the function is zero
+     * @throws MaxIterationsExceededException the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating  the function
+     * @throws IllegalArgumentException if initial is not between min and max
+     * (even if it <em>is</em> a root)
+     */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max, final double initial)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max, initial);
+    }
+
+    /**
      * Find a zero in the given interval.
      * <p>
      * Requires that the values of the function at the endpoints have opposite
@@ -184,7 +215,9 @@ public class BrentSolver extends Univari
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if min is not less than max or the
      * signs of the values of the function at the endpoints are not opposites
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max)
         throws MaxIterationsExceededException, MathUserException {
@@ -228,6 +261,30 @@ public class BrentSolver extends Univari
     }
 
     /**
+     * Find a zero in the given interval.
+     * <p>
+     * Requires that the values of the function at the endpoints have opposite
+     * signs. An <code>IllegalArgumentException</code> is thrown if this is not
+     * the case.</p>
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval.
+     * @param max the upper bound for the interval.
+     * @param maxEval Maximum number of evaluations.
+     * @return the value where the function is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if min is not less than max or the
+     * signs of the values of the function at the endpoints are not opposites
+     */
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max);
+    }
+
+    /**
      * Find a zero starting search according to the three provided points.
      * @param f the function to solve
      * @param x0 old approximation for the root

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
Sun Dec  5 11:56:41 2010
@@ -68,7 +68,9 @@ public class LaguerreSolver extends Univ
 
     /**
      * Construct a solver.
+     * @deprecated in 2.2 (to be removed in 3.0)
      */
+    @Deprecated
     public LaguerreSolver() {
         super(100, 1E-6);
         p = null;
@@ -108,12 +110,38 @@ public class LaguerreSolver extends Univ
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
      * @param initial the start value to use
+     * @param maxEval Maximum number of evaluations.
+     * @return the point at which the function value is zero
+     * @throws ConvergenceException if the maximum iteration count is exceeded
+     * or the solver detects convergence problems otherwise
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if any parameters are invalid
+     */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max, final double initial)
+        throws ConvergenceException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max, initial);
+    }
+
+    /**
+     * Find a real root in the given interval with initial value.
+     * <p>
+     * Requires bracketing condition.</p>
+     *
+     * @param f function to solve (must be polynomial)
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
+     * @param initial the start value to use
      * @return the point at which the function value is zero
      * @throws ConvergenceException if the maximum iteration count is exceeded
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max, final double initial)
         throws ConvergenceException, MathUserException {
@@ -151,12 +179,41 @@ public class LaguerreSolver extends Univ
      * @param f the function to solve
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
+     * @param maxEval Maximum number of evaluations.
      * @return the point at which the function value is zero
      * @throws ConvergenceException if the maximum iteration count is exceeded
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
      */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max)
+        throws ConvergenceException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max);
+    }
+
+    /**
+     * Find a real root in the given interval.
+     * <p>
+     * Despite the bracketing condition, the root returned by solve(Complex[],
+     * Complex) may not be a real zero inside [min, max]. For example,
+     * p(x) = x^3 + 1, min = -2, max = 2, initial = 0. We can either try
+     * another initial value, or, as we did here, call solveAll() to obtain
+     * all roots and pick up the one that we're looking for.</p>
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
+     * @return the point at which the function value is zero
+     * @throws ConvergenceException if the maximum iteration count is exceeded
+     * or the solver detects convergence problems otherwise
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2 (to be removed in 3.0).
+     */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max)
         throws ConvergenceException, MathUserException {
@@ -223,7 +280,9 @@ public class LaguerreSolver extends Univ
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2.
      */
+    @Deprecated
     public Complex[] solveAll(double coefficients[], double initial) throws
         ConvergenceException, MathUserException {
 
@@ -246,7 +305,9 @@ public class LaguerreSolver extends Univ
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2.
      */
+    @Deprecated
     public Complex[] solveAll(Complex coefficients[], Complex initial) throws
         MaxIterationsExceededException, MathUserException {
 
@@ -294,7 +355,9 @@ public class LaguerreSolver extends Univ
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2.
      */
+    @Deprecated
     public Complex solve(Complex coefficients[], Complex initial) throws
         MaxIterationsExceededException, MathUserException {
 

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
Sun Dec  5 11:56:41 2010
@@ -54,7 +54,9 @@ public class MullerSolver extends Univar
 
     /**
      * Construct a solver.
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public MullerSolver() {
         super(100, 1E-6);
     }
@@ -82,12 +84,37 @@ public class MullerSolver extends Univar
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
      * @param initial the start value to use
+     * @param maxEval Maximum number of evaluations.
      * @return the point at which the function value is zero
      * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
      */
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max, final double initial)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max, initial);
+    }
+
+    /**
+     * Find a real root in the given interval with initial value.
+     * <p>
+     * Requires bracketing condition.</p>
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
+     * @param initial the start value to use
+     * @return the point at which the function value is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * or the solver detects convergence problems otherwise
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2 (to be removed in 3.0).
+     */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max, final double initial)
         throws MaxIterationsExceededException, MathUserException {
@@ -124,12 +151,47 @@ public class MullerSolver extends Univar
      * @param f the function to solve
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
+     * @param maxEval Maximum number of evaluations.
      * @return the point at which the function value is zero
      * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
      */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max);
+    }
+
+    /**
+     * Find a real root in the given interval.
+     * <p>
+     * Original Muller's method would have function evaluation at complex point.
+     * Since our f(x) is real, we have to find ways to avoid that. Bracketing
+     * condition is one way to go: by requiring bracketing in every iteration,
+     * the newly computed approximation is guaranteed to be real.</p>
+     * <p>
+     * Normally Muller's method converges quadratically in the vicinity of a
+     * zero, however it may be very slow in regions far away from zeros. For
+     * example, f(x) = exp(x) - 1, min = -50, max = 100. In such case we use
+     * bisection as a safety backup if it performs very poorly.</p>
+     * <p>
+     * The formulas here use divided differences directly.</p>
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
+     * @return the point at which the function value is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * or the solver detects convergence problems otherwise
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2 (to be removed in 3.0).
+     */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max)
         throws MaxIterationsExceededException, MathUserException {
@@ -271,7 +333,9 @@ public class MullerSolver extends Univar
      * or the solver detects convergence problems otherwise
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve2(final UnivariateRealFunction f,
                          final double min, final double max)
         throws MaxIterationsExceededException, MathUserException {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
Sun Dec  5 11:56:41 2010
@@ -50,7 +50,9 @@ public class NewtonSolver extends Univar
 
     /**
      * Construct a solver.
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public NewtonSolver() {
         super(100, 1E-6);
     }
@@ -75,11 +77,33 @@ public class NewtonSolver extends Univar
      * @param f the function to solve
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
+     * @param maxEval Maximum number of evaluations.
      * @return the value where the function is zero
      * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
      * @throws MathUserException if an error occurs evaluating the function or derivative
      * @throws IllegalArgumentException if min is not less than max
      */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max)
+        throws MaxIterationsExceededException, MathUserException  {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max);
+    }
+
+    /**
+     * Find a zero near the midpoint of <code>min</code> and <code>max</code>.
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
+     * @return the value where the function is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating the function or derivative
+     * @throws IllegalArgumentException if min is not less than max
+     * @deprecated in 2.2 (to be removed in 3.0).
+     */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max)
         throws MaxIterationsExceededException, MathUserException  {
@@ -93,12 +117,36 @@ public class NewtonSolver extends Univar
      * @param min the lower bound for the interval (ignored).
      * @param max the upper bound for the interval (ignored).
      * @param startValue the start value to use.
+     * @param maxEval Maximum number of evaluations.
      * @return the value where the function is zero
      * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
      * @throws MathUserException if an error occurs evaluating the function or derivative
      * @throws IllegalArgumentException if startValue is not between min and max or
      * if function is not a {@link DifferentiableUnivariateRealFunction} instance
      */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max, final double startValue)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max, startValue);
+    }
+
+    /**
+     * Find a zero near the value <code>startValue</code>.
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval (ignored).
+     * @param max the upper bound for the interval (ignored).
+     * @param startValue the start value to use.
+     * @return the value where the function is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating the function or derivative
+     * @throws IllegalArgumentException if startValue is not between min and max or
+     * if function is not a {@link DifferentiableUnivariateRealFunction} instance
+     * @deprecated in 2.2 (to be removed in 3.0).
+     */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max, final double startValue)
         throws MaxIterationsExceededException, MathUserException {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
Sun Dec  5 11:56:41 2010
@@ -53,7 +53,9 @@ public class RiddersSolver extends Univa
 
     /**
      * Construct a solver.
+     * @deprecated in 2.2
      */
+    @Deprecated
     public RiddersSolver() {
         super(100, 1E-6);
     }
@@ -81,11 +83,36 @@ public class RiddersSolver extends Univa
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
      * @param initial the start value to use
+     * @param maxEval Maximum number of evaluations.
+     * @return the point at which the function value is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if any parameters are invalid
+     */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max, final double initial)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max, initial);
+    }
+
+    /**
+     * Find a root in the given interval with initial value.
+     * <p>
+     * Requires bracketing condition.</p>
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
+     * @param initial the start value to use
      * @return the point at which the function value is zero
      * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max, final double initial)
         throws MaxIterationsExceededException, MathUserException {
@@ -112,11 +139,35 @@ public class RiddersSolver extends Univa
      * @param f the function to solve
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
+     * @param maxEval Maximum number of evaluations.
+     * @return the point at which the function value is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if any parameters are invalid
+     */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max);
+    }
+
+    /**
+     * Find a root in the given interval.
+     * <p>
+     * Requires bracketing condition.</p>
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
      * @return the point at which the function value is zero
      * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if any parameters are invalid
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max)
         throws MaxIterationsExceededException, MathUserException {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
Sun Dec  5 11:56:41 2010
@@ -58,7 +58,9 @@ public class SecantSolver extends Univar
 
     /**
      * Construct a solver.
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public SecantSolver() {
         super(100, 1E-6);
     }
@@ -84,12 +86,36 @@ public class SecantSolver extends Univar
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
      * @param initial the start value to use (ignored)
+     * @param maxEval Maximum number of evaluations.
+     * @return the value where the function is zero
+     * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if min is not less than max or the
+     * signs of the values of the function at the endpoints are not opposites
+     */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max, final double initial)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max, initial);
+    }
+
+    /**
+     * Find a zero in the given interval.
+     *
+     * @param f the function to solve
+     * @param min the lower bound for the interval
+     * @param max the upper bound for the interval
+     * @param initial the start value to use (ignored)
      * @return the value where the function is zero
      * @throws MaxIterationsExceededException if the maximum iteration count is exceeded
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if min is not less than max or the
      * signs of the values of the function at the endpoints are not opposites
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max, final double initial)
         throws MaxIterationsExceededException, MathUserException {
@@ -101,12 +127,34 @@ public class SecantSolver extends Univar
      * @param f the function to solve
      * @param min the lower bound for the interval.
      * @param max the upper bound for the interval.
+     * @param maxEval Maximum number of evaluations.
+     * @return the value where the function is zero
+     * @throws MaxIterationsExceededException  if the maximum iteration count is exceeded
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if min is not less than max or the
+     * signs of the values of the function at the endpoints are not opposites
+     */
+    @Override
+    public double solve(int maxEval, final UnivariateRealFunction f,
+                        final double min, final double max)
+        throws MaxIterationsExceededException, MathUserException {
+        setMaximalIterationCount(maxEval);
+        return solve(f, min, max);
+    }
+
+    /**
+     * Find a zero in the given interval.
+     * @param f the function to solve
+     * @param min the lower bound for the interval.
+     * @param max the upper bound for the interval.
      * @return the value where the function is zero
      * @throws MaxIterationsExceededException  if the maximum iteration count is exceeded
      * @throws MathUserException if an error occurs evaluating the function
      * @throws IllegalArgumentException if min is not less than max or the
      * signs of the values of the function at the endpoints are not opposites
+     * @deprecated in 2.2 (to be removed in 3.0).
      */
+    @Deprecated
     public double solve(final UnivariateRealFunction f,
                         final double min, final double max)
         throws MaxIterationsExceededException, MathUserException {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
Sun Dec  5 11:56:41 2010
@@ -87,6 +87,27 @@ public interface UnivariateRealSolver ex
      * @param f the function to solve.
      * @param min the lower bound for the interval.
      * @param max the upper bound for the interval.
+     * @param maxEval Maximum number of evaluations.
+     * @return a value where the function is zero
+     * @throws ConvergenceException if the maximum iteration count is exceeded
+     * or the solver detects convergence problems otherwise.
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if min > max or the endpoints do not
+     * satisfy the requirements specified by the solver
+     * @since 2.2
+     */
+    double solve(int maxEval, UnivariateRealFunction f, double min, double max)
+        throws ConvergenceException, MathUserException;
+    
+    /**
+     * Solve for a zero root in the given interval.
+     * <p>A solver may require that the interval brackets a single zero root.
+     * Solvers that do require bracketing should be able to handle the case
+     * where one of the endpoints is itself a root.</p>
+     *
+     * @param f the function to solve.
+     * @param min the lower bound for the interval.
+     * @param max the upper bound for the interval.
      * @return a value where the function is zero
      * @throws ConvergenceException if the maximum iteration count is exceeded
      * or the solver detects convergence problems otherwise.
@@ -94,7 +115,10 @@ public interface UnivariateRealSolver ex
      * @throws IllegalArgumentException if min > max or the endpoints do not
      * satisfy the requirements specified by the solver
      * @since 2.0
+     * @deprecated in 2.2 (to be removed in 3.0). Please use
+     * {@link #solve(int,UnivariateRealFunction,double,double)} instead.
      */
+    @Deprecated
     double solve(UnivariateRealFunction f, double min, double max)
         throws ConvergenceException, MathUserException;
 
@@ -130,6 +154,28 @@ public interface UnivariateRealSolver ex
      * @param min the lower bound for the interval.
      * @param max the upper bound for the interval.
      * @param startValue the start value to use
+     * @param maxEval Maximum number of evaluations.
+     * @return a value where the function is zero
+     * @throws ConvergenceException if the maximum iteration count is exceeded
+     * or the solver detects convergence problems otherwise.
+     * @throws MathUserException if an error occurs evaluating the function
+     * @throws IllegalArgumentException if min > max or the arguments do not
+     * satisfy the requirements specified by the solver
+     * @since 2.2
+     */
+    double solve(int maxEval, UnivariateRealFunction f, double min, double max, double startValue)
+        throws ConvergenceException, MathUserException, IllegalArgumentException;
+
+    /**
+     * Solve for a zero in the given interval, start at startValue.
+     * <p>A solver may require that the interval brackets a single zero root.
+     * Solvers that do require bracketing should be able to handle the case
+     * where one of the endpoints is itself a root.</p>
+     *
+     * @param f the function to solve.
+     * @param min the lower bound for the interval.
+     * @param max the upper bound for the interval.
+     * @param startValue the start value to use
      * @return a value where the function is zero
      * @throws ConvergenceException if the maximum iteration count is exceeded
      * or the solver detects convergence problems otherwise.
@@ -137,6 +183,8 @@ public interface UnivariateRealSolver ex
      * @throws IllegalArgumentException if min > max or the arguments do not
      * satisfy the requirements specified by the solver
      * @since 2.0
+     * @deprecated in 2.2 (to be removed in 3.0). Please use
+     * {@link #solve(int,UnivariateRealFunction,double,double,double)} instead.
      */
     double solve(UnivariateRealFunction f, double min, double max, double startValue)
         throws ConvergenceException, MathUserException, IllegalArgumentException;

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java?rev=1042324&r1=1042323&r2=1042324&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
Sun Dec  5 11:56:41 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.Convergin
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.exception.util.LocalizedFormats;
+import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NullArgumentException;
 
@@ -134,6 +135,18 @@ public abstract class UnivariateRealSolv
         functionValueAccuracy = defaultFunctionValueAccuracy;
     }
 
+    /** {@inheritDoc} */
+    public double solve(int maxEval, UnivariateRealFunction f, double min, double max)
+        throws ConvergenceException, MathUserException {
+        throw new UnsupportedOperationException("Method not overriden");
+    }
+
+    /** {@inheritDoc} */
+    public double solve(int maxEval, UnivariateRealFunction f, double min, double max, double
startValue)
+        throws ConvergenceException, MathUserException, IllegalArgumentException {
+        throw new UnsupportedOperationException("Method not overriden");
+    }
+
     /**
      * Convenience function for implementations.
      *



Mime
View raw message