diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java index 414a03dd4..cd8156431 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java @@ -31,20 +31,6 @@ import org.apache.commons.math.util.FastMath; */ public class BisectionSolver extends UnivariateRealSolverImpl { - /** - * Construct a solver for the given function. - * - * @param f function to solve. - * @deprecated as of 2.0 the function to solve is passed as an argument - * to the {@link #solve(UnivariateRealFunction, double, double)} or - * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)} - * method. - */ - @Deprecated - public BisectionSolver(UnivariateRealFunction f) { - super(f, 100, 1E-6); - } - /** * Construct a solver. * @@ -53,20 +39,6 @@ public class BisectionSolver extends UnivariateRealSolverImpl { super(100, 1E-6); } - /** {@inheritDoc} */ - @Deprecated - public double solve(double min, double max, double initial) - throws MaxIterationsExceededException, FunctionEvaluationException { - return solve(f, min, max); - } - - /** {@inheritDoc} */ - @Deprecated - public double solve(double min, double max) - throws MaxIterationsExceededException, FunctionEvaluationException { - return solve(f, min, max); - } - /** {@inheritDoc} */ public double solve(final UnivariateRealFunction f, double min, double max, double initial) throws MaxIterationsExceededException, FunctionEvaluationException { diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java index 6df007e04..d2ea1b630 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java @@ -48,20 +48,6 @@ public class BrentSolver extends UnivariateRealSolverImpl { /** Serializable version identifier */ private static final long serialVersionUID = 7694577816772532779L; - /** - * Construct a solver for the given function. - * - * @param f function to solve. - * @deprecated as of 2.0 the function to solve is passed as an argument - * to the {@link #solve(UnivariateRealFunction, double, double)} or - * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)} - * method. - */ - @Deprecated - public BrentSolver(UnivariateRealFunction f) { - super(f, DEFAULT_MAXIMUM_ITERATIONS, DEFAULT_ABSOLUTE_ACCURACY); - } - /** * Construct a solver with default properties. */ @@ -90,20 +76,6 @@ public class BrentSolver extends UnivariateRealSolverImpl { super(maximumIterations, absoluteAccuracy); } - /** {@inheritDoc} */ - @Deprecated - public double solve(double min, double max) - throws MaxIterationsExceededException, FunctionEvaluationException { - return solve(f, min, max); - } - - /** {@inheritDoc} */ - @Deprecated - public double solve(double min, double max, double initial) - throws MaxIterationsExceededException, FunctionEvaluationException { - return solve(f, min, max, initial); - } - /** * Find a zero in the given interval with an initial guess. *
Throws IllegalArgumentException
if the values of the
diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
index a5c61f3a7..47d334a26 100644
--- a/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
+++ b/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
@@ -40,64 +40,11 @@ import org.apache.commons.math.util.FastMath;
*/
public class LaguerreSolver extends UnivariateRealSolverImpl {
- /** polynomial function to solve.
- * @deprecated as of 2.0 the function is not stored anymore in the instance
- */
- @Deprecated
- private final PolynomialFunction p;
-
- /**
- * Construct a solver for the given function.
- *
- * @param f function to solve
- * @throws IllegalArgumentException if function is not polynomial
- * @deprecated as of 2.0 the function to solve is passed as an argument
- * to the {@link #solve(UnivariateRealFunction, double, double)} or
- * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}
- * method.
- */
- @Deprecated
- public LaguerreSolver(UnivariateRealFunction f) throws
- IllegalArgumentException {
- super(f, 100, 1E-6);
- if (f instanceof PolynomialFunction) {
- p = (PolynomialFunction) f;
- } else {
- throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.FUNCTION_NOT_POLYNOMIAL);
- }
- }
-
/**
* Construct a solver.
*/
public LaguerreSolver() {
super(100, 1E-6);
- p = null;
- }
-
- /**
- * Returns a copy of the polynomial function.
- *
- * @return a fresh copy of the polynomial function
- * @deprecated as of 2.0 the function is not stored anymore within the instance.
- */
- @Deprecated
- public PolynomialFunction getPolynomialFunction() {
- return new PolynomialFunction(p.getCoefficients());
- }
-
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max)
- throws ConvergenceException, FunctionEvaluationException {
- return solve(p, min, max);
- }
-
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max, final double initial)
- throws ConvergenceException, FunctionEvaluationException {
- return solve(p, min, max, initial);
}
/**
diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
index e9702f24f..763aa6970 100644
--- a/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
+++ b/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
@@ -38,20 +38,6 @@ import org.apache.commons.math.util.MathUtils;
*/
public class MullerSolver extends UnivariateRealSolverImpl {
- /**
- * Construct a solver for the given function.
- *
- * @param f function to solve
- * @deprecated as of 2.0 the function to solve is passed as an argument
- * to the {@link #solve(UnivariateRealFunction, double, double)} or
- * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}
- * method.
- */
- @Deprecated
- public MullerSolver(UnivariateRealFunction f) {
- super(f, 100, 1E-6);
- }
-
/**
* Construct a solver.
*/
@@ -59,20 +45,6 @@ public class MullerSolver extends UnivariateRealSolverImpl {
super(100, 1E-6);
}
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max)
- throws ConvergenceException, FunctionEvaluationException {
- return solve(f, min, max);
- }
-
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max, final double initial)
- throws ConvergenceException, FunctionEvaluationException {
- return solve(f, min, max, initial);
- }
-
/**
* Find a real root in the given interval with initial value.
*
@@ -217,39 +189,6 @@ public class MullerSolver extends UnivariateRealSolverImpl { throw new MaxIterationsExceededException(maximalIterationCount); } - /** - * Find a real root in the given interval. - *
- * solve2() differs from solve() in the way it avoids complex operations. - * Except for the initial [min, max], solve2() does not require bracketing - * condition, e.g. f(x0), f(x1), f(x2) can have the same sign. If complex - * number arises in the computation, we simply use its modulus as real - * approximation.
- *- * Because the interval may not be bracketing, bisection alternative is - * not applicable here. However in practice our treatment usually works - * well, especially near real zeros where the imaginary part of complex - * approximation is often negligible.
- *- * The formulas here do not use divided differences directly.
- * - * @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 FunctionEvaluationException if an error occurs evaluating the - * function - * @throws IllegalArgumentException if any parameters are invalid - * @deprecated replaced by {@link #solve2(UnivariateRealFunction, double, double)} - * since 2.0 - */ - @Deprecated - public double solve2(final double min, final double max) - throws MaxIterationsExceededException, FunctionEvaluationException { - return solve2(f, min, max); - } - /** * Find a real root in the given interval. *
diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
index 1033c74a9..9ee75b1a2 100644
--- a/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
+++ b/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
@@ -35,19 +35,6 @@ import org.apache.commons.math.util.FastMath;
*/
public class NewtonSolver extends UnivariateRealSolverImpl {
- /**
- * Construct a solver for the given function.
- * @param f function to solve.
- * @deprecated as of 2.0 the function to solve is passed as an argument
- * to the {@link #solve(UnivariateRealFunction, double, double)} or
- * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}
- * method.
- */
- @Deprecated
- public NewtonSolver(DifferentiableUnivariateRealFunction f) {
- super(f, 100, 1E-6);
- }
-
/**
* Construct a solver.
*/
@@ -55,21 +42,6 @@ public class NewtonSolver extends UnivariateRealSolverImpl {
super(100, 1E-6);
}
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max)
- throws MaxIterationsExceededException,
- FunctionEvaluationException {
- return solve(f, min, max);
- }
-
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max, final double startValue)
- throws MaxIterationsExceededException, FunctionEvaluationException {
- return solve(f, min, max, startValue);
- }
-
/**
* Find a zero near the midpoint of min
and max
.
*
diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
index a131c5acc..ab09a7b30 100644
--- a/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
+++ b/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
@@ -37,20 +37,6 @@ import org.apache.commons.math.util.MathUtils;
*/
public class RiddersSolver extends UnivariateRealSolverImpl {
- /**
- * Construct a solver for the given function.
- *
- * @param f function to solve
- * @deprecated as of 2.0 the function to solve is passed as an argument
- * to the {@link #solve(UnivariateRealFunction, double, double)} or
- * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}
- * method.
- */
- @Deprecated
- public RiddersSolver(UnivariateRealFunction f) {
- super(f, 100, 1E-6);
- }
-
/**
* Construct a solver.
*/
@@ -58,20 +44,6 @@ public class RiddersSolver extends UnivariateRealSolverImpl {
super(100, 1E-6);
}
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max)
- throws ConvergenceException, FunctionEvaluationException {
- return solve(f, min, max);
- }
-
- /** {@inheritDoc} */
- @Deprecated
- public double solve(final double min, final double max, final double initial)
- throws ConvergenceException, FunctionEvaluationException {
- return solve(f, min, max, initial);
- }
-
/**
* Find a root in the given interval with initial value.
*
diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java index c9c911d52..20bfc8ec0 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java @@ -43,19 +43,6 @@ import org.apache.commons.math.util.FastMath; */ public class SecantSolver extends UnivariateRealSolverImpl { - /** - * Construct a solver for the given function. - * @param f function to solve. - * @deprecated as of 2.0 the function to solve is passed as an argument - * to the {@link #solve(UnivariateRealFunction, double, double)} or - * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)} - * method. - */ - @Deprecated - public SecantSolver(UnivariateRealFunction f) { - super(f, 100, 1E-6); - } - /** * Construct a solver. */ @@ -63,20 +50,6 @@ public class SecantSolver extends UnivariateRealSolverImpl { super(100, 1E-6); } - /** {@inheritDoc} */ - @Deprecated - public double solve(final double min, final double max) - throws ConvergenceException, FunctionEvaluationException { - return solve(f, min, max); - } - - /** {@inheritDoc} */ - @Deprecated - public double solve(final double min, final double max, final double initial) - throws ConvergenceException, FunctionEvaluationException { - return solve(f, min, max, initial); - } - /** * Find a zero in the given interval. * diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java index abb1932ec..ff47008ce 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java @@ -58,28 +58,6 @@ public interface UnivariateRealSolver extends ConvergingAlgorithm { */ void resetFunctionValueAccuracy(); - /** - * Solve for a zero root in the given interval. - *
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.
- * - * @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. - * @throws FunctionEvaluationException if an error occurs evaluating the - * function - * @throws IllegalArgumentException if min > max or the endpoints do not - * satisfy the requirements specified by the solver - * @deprecated replaced by {@link #solve(UnivariateRealFunction, double, double)} - * since 2.0 - */ - @Deprecated - double solve(double min, double max) throws ConvergenceException, - FunctionEvaluationException; - /** * Solve for a zero root in the given interval. *A solver may require that the interval brackets a single zero root. @@ -102,29 +80,6 @@ public interface UnivariateRealSolver extends ConvergingAlgorithm { throws ConvergenceException, FunctionEvaluationException; - /** - * Solve for a zero in the given interval, start at startValue. - *
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.
- * - * @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. - * @throws FunctionEvaluationException if an error occurs evaluating the - * function - * @throws IllegalArgumentException if min > max or the arguments do not - * satisfy the requirements specified by the solver - * @deprecated replaced by {@link #solve(UnivariateRealFunction, double, double, double)} - * since 2.0 - */ - @Deprecated - double solve(double min, double max, double startValue) - throws ConvergenceException, FunctionEvaluationException, IllegalArgumentException; - /** * Solve for a zero in the given interval, start at startValue. *A solver may require that the interval brackets a single zero root. diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java index eb4289ab3..6fd513c7f 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java @@ -48,40 +48,6 @@ public abstract class UnivariateRealSolverImpl /** Value of the function at the last computed result. */ protected double functionValue; - /** The function to solve. - * @deprecated as of 2.0 the function to solve is passed as an argument - * to the {@link #solve(UnivariateRealFunction, double, double)} or - * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)} - * method. */ - @Deprecated - protected UnivariateRealFunction f; - - /** - * Construct a solver with given iteration count and accuracy. - * - * @param f the function to solve. - * @param defaultAbsoluteAccuracy maximum absolute error - * @param defaultMaximalIterationCount maximum number of iterations - * @throws IllegalArgumentException if f is null or the - * defaultAbsoluteAccuracy is not valid - * @deprecated as of 2.0 the function to solve is passed as an argument - * to the {@link #solve(UnivariateRealFunction, double, double)} or - * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)} - * method. - */ - @Deprecated - protected UnivariateRealSolverImpl(final UnivariateRealFunction f, - final int defaultMaximalIterationCount, - final double defaultAbsoluteAccuracy) { - super(defaultMaximalIterationCount, defaultAbsoluteAccuracy); - if (f == null) { - throw new NullArgumentException(LocalizedFormats.FUNCTION); - } - this.f = f; - this.defaultFunctionValueAccuracy = 1.0e-15; - this.functionValueAccuracy = defaultFunctionValueAccuracy; - } - /** * Construct a solver with given iteration count and accuracy. * diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java index 5ddaa0562..7fbfa3d7d 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java @@ -29,19 +29,6 @@ import junit.framework.TestCase; */ public final class BisectionSolverTest extends TestCase { - @Deprecated - public void testDeprecated() throws MathException { - UnivariateRealFunction f = new SinFunction(); - double result; - - UnivariateRealSolver solver = new BisectionSolver(f); - result = solver.solve(3, 4); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - - result = solver.solve(1, 4); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - } - public void testSinZero() throws MathException { UnivariateRealFunction f = new SinFunction(); double result; diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java index 169098786..3654fb40a 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java @@ -42,44 +42,6 @@ public final class BrentSolverTest extends TestCase { super(name); } - @Deprecated - public void testDeprecated() throws MathException { - // The sinus function is behaved well around the root at #pi. The second - // order derivative is zero, which means linar approximating methods will - // still converge quadratically. - UnivariateRealFunction f = new SinFunction(); - double result; - UnivariateRealSolver solver = new BrentSolver(f); - // Somewhat benign interval. The function is monotone. - result = solver.solve(3, 4); - //System.out.println( - // "Root: " + result + " Iterations: " + solver.getIterationCount()); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - // 4 iterations on i586 JDK 1.4.1. - assertTrue(solver.getIterationCount() <= 5); - // Larger and somewhat less benign interval. The function is grows first. - result = solver.solve(1, 4); - //System.out.println( - // "Root: " + result + " Iterations: " + solver.getIterationCount()); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - // 5 iterations on i586 JDK 1.4.1. - assertTrue(solver.getIterationCount() <= 6); - solver = new SecantSolver(f); - result = solver.solve(3, 4); - //System.out.println( - // "Root: " + result + " Iterations: " + solver.getIterationCount()); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - // 4 iterations on i586 JDK 1.4.1. - assertTrue(solver.getIterationCount() <= 5); - result = solver.solve(1, 4); - //System.out.println( - // "Root: " + result + " Iterations: " + solver.getIterationCount()); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - // 5 iterations on i586 JDK 1.4.1. - assertTrue(solver.getIterationCount() <= 6); - assertEquals(result, solver.getResult(), 0); - } - public void testSinZero() throws MathException { // The sinus function is behaved well around the root at #pi. The second // order derivative is zero, which means linar approximating methods will diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java index ab52dd804..9e9aa8c6f 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java @@ -37,25 +37,6 @@ import junit.framework.TestCase; */ public final class LaguerreSolverTest extends TestCase { - /** - * Test deprecated APIs. - */ - @Deprecated - public void testDeprecated() throws MathException { - double min, max, expected, result, tolerance; - - // p(x) = 4x - 1 - double coefficients[] = { -1.0, 4.0 }; - PolynomialFunction f = new PolynomialFunction(coefficients); - UnivariateRealSolver solver = new LaguerreSolver(f); - - min = 0.0; max = 1.0; expected = 0.25; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve(min, max); - assertEquals(expected, result, tolerance); - } - /** * Test of solver for the linear function. */ diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java index af265466c..40ae2014d 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java @@ -40,56 +40,6 @@ import junit.framework.TestCase; */ public final class MullerSolverTest extends TestCase { - /** - * Test deprecated APIs. - */ - @Deprecated - public void testDeprecated() throws MathException { - UnivariateRealFunction f = new SinFunction(); - UnivariateRealSolver solver = new MullerSolver(f); - double min, max, expected, result, tolerance; - - min = 3.0; max = 4.0; expected = FastMath.PI; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve(min, max); - assertEquals(expected, result, tolerance); - - min = -1.0; max = 1.5; expected = 0.0; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve(min, max); - assertEquals(expected, result, tolerance); - } - - /** - * Test deprecated APIs. - */ - @Deprecated - public void testDeprecated2() throws MathException { - UnivariateRealFunction f = new QuinticFunction(); - MullerSolver solver = new MullerSolver(f); - double min, max, expected, result, tolerance; - - min = -0.4; max = 0.2; expected = 0.0; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve2(min, max); - assertEquals(expected, result, tolerance); - - min = 0.75; max = 1.5; expected = 1.0; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve2(min, max); - assertEquals(expected, result, tolerance); - - min = -0.9; max = -0.2; expected = -0.5; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve2(min, max); - assertEquals(expected, result, tolerance); - } - /** * Test of solver for the sine function. */ diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java index 9383423c1..20aa15481 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java @@ -30,16 +30,18 @@ import junit.framework.TestCase; */ public final class NewtonSolverTest extends TestCase { - @Deprecated - public void testDeprecated() throws MathException { + /** + * + */ + public void testSinZero() throws MathException { DifferentiableUnivariateRealFunction f = new SinFunction(); double result; - UnivariateRealSolver solver = new NewtonSolver(f); - result = solver.solve(3, 4); + UnivariateRealSolver solver = new NewtonSolver(); + result = solver.solve(f, 3, 4); assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - result = solver.solve(1, 4); + result = solver.solve(f, 1, 4); assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); assertEquals(result, solver.getResult(), 0); @@ -47,24 +49,6 @@ public final class NewtonSolverTest extends TestCase { } /** - * - */ - public void testSinZero() throws MathException { - DifferentiableUnivariateRealFunction f = new SinFunction(); - double result; - - UnivariateRealSolver solver = new NewtonSolver(); - result = solver.solve(f, 3, 4); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - - result = solver.solve(f, 1, 4); - assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy()); - - assertEquals(result, solver.getResult(), 0); - assertTrue(solver.getIterationCount() > 0); - } - - /** * */ public void testQuinticZero() throws MathException { diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java index 14a841d37..8c591ec53 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java @@ -38,28 +38,6 @@ import junit.framework.TestCase; */ public final class RiddersSolverTest extends TestCase { - /** - * Test the deprecated APIs. - */ - @Deprecated - public void testDeprecated() throws MathException { - UnivariateRealFunction f = new SinFunction(); - UnivariateRealSolver solver = new RiddersSolver(f); - double min, max, expected, result, tolerance; - - min = 3.0; max = 4.0; expected = FastMath.PI; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve(min, max); - assertEquals(expected, result, tolerance); - - min = -1.0; max = 1.5; expected = 0.0; - tolerance = FastMath.max(solver.getAbsoluteAccuracy(), - FastMath.abs(expected * solver.getRelativeAccuracy())); - result = solver.solve(min, max); - assertEquals(expected, result, tolerance); - } - /** * Test of solver for the sine function. */