Author: erans
Date: Sat Nov 13 22:27:34 2010
New Revision: 1034896
URL: http://svn.apache.org/viewvc?rev=1034896&view=rev
Log:
MATH-438
Removed deprecated methods.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
Sat Nov 13 22:27:34 2010
@@ -32,20 +32,6 @@ import org.apache.commons.math.util.Fast
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.
*
*/
@@ -54,20 +40,6 @@ public class BisectionSolver extends Uni
}
/** {...@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 {
return solve(f, min, max);
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
Sat Nov 13 22:27:34 2010
@@ -49,20 +49,6 @@ public class BrentSolver extends Univari
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.
*/
public BrentSolver() {
@@ -90,20 +76,6 @@ public class BrentSolver extends Univari
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.
* <p>Throws <code>IllegalArgumentException</code> if the values of the
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
Sat Nov 13 22:27:34 2010
@@ -40,64 +40,11 @@ import org.apache.commons.math.util.Fast
*/
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);
}
/**
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
Sat Nov 13 22:27:34 2010
@@ -39,40 +39,12 @@ import org.apache.commons.math.util.Math
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.
*/
public MullerSolver() {
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.
* <p>
@@ -233,39 +205,6 @@ public class MullerSolver extends Univar
* <p>
* The formulas here do not use divided differences directly.</p>
*
- * @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.
- * <p>
- * 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.</p>
- * <p>
- * 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.</p>
- * <p>
- * The formulas here do not 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
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
Sat Nov 13 22:27:34 2010
@@ -36,40 +36,12 @@ import org.apache.commons.math.util.Fast
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.
*/
public NewtonSolver() {
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 <code>min</code> and <code>max</code>.
*
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
Sat Nov 13 22:27:34 2010
@@ -38,40 +38,12 @@ import org.apache.commons.math.util.Math
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.
*/
public RiddersSolver() {
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.
* <p>
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
Sat Nov 13 22:27:34 2010
@@ -44,39 +44,12 @@ import org.apache.commons.math.util.Fast
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.
*/
public SecantSolver() {
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.
*
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
Sat Nov 13 22:27:34 2010
@@ -64,28 +64,6 @@ public interface UnivariateRealSolver ex
* Solvers that do require bracketing should be able to handle the case
* where one of the endpoints is itself a root.</p>
*
- * @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.
- * <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.
@@ -108,29 +86,6 @@ public interface UnivariateRealSolver ex
* Solvers that do require bracketing should be able to handle the case
* where one of the endpoints is itself a root.</p>
*
- * @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.
- * <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.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
Sat Nov 13 22:27:34 2010
@@ -48,40 +48,6 @@ public abstract class UnivariateRealSolv
/** 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.
*
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BisectionSolverTest.java
Sat Nov 13 22:27:34 2010
@@ -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;
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java
Sat Nov 13 22:27:34 2010
@@ -42,44 +42,6 @@ public final class BrentSolverTest exten
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
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java
Sat Nov 13 22:27:34 2010
@@ -38,25 +38,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.
*/
public void testLinearFunction() throws MathException {
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java
Sat Nov 13 22:27:34 2010
@@ -41,56 +41,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.
*/
public void testSinFunction() throws MathException {
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/NewtonSolverTest.java
Sat Nov 13 22:27:34 2010
@@ -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 exte
}
/**
- *
- */
- 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 {
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java?rev=1034896&r1=1034895&r2=1034896&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java
Sat Nov 13 22:27:34 2010
@@ -39,28 +39,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.
*/
public void testSinFunction() throws MathException {