You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2011/02/15 02:31:14 UTC

svn commit: r1070725 [2/3] - in /commons/proper/math/branches/MATH_2_X/src: main/java/org/apache/commons/math/ main/java/org/apache/commons/math/analysis/ main/java/org/apache/commons/math/analysis/integration/ main/java/org/apache/commons/math/analysi...

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=1070725&r1=1070724&r2=1070725&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 Tue Feb 15 01:31:12 2011
@@ -18,11 +18,11 @@
 package org.apache.commons.math.analysis.solvers;
 
 import org.apache.commons.math.ConvergingAlgorithmImpl;
+import org.apache.commons.math.FunctionEvaluationException;
 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;
 
 /**
@@ -149,13 +149,13 @@ public abstract class UnivariateRealSolv
      * @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 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
      * @since 2.2
      */
     public double solve(int maxEval, UnivariateRealFunction function, double min, double max)
-        throws ConvergenceException, MathUserException {
+        throws ConvergenceException, FunctionEvaluationException {
         throw MathRuntimeException.createUnsupportedOperationException(LocalizedFormats.NOT_OVERRIDEN);
     }
 
@@ -173,13 +173,13 @@ public abstract class UnivariateRealSolv
      * @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 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
      * @since 2.2
      */
     public double solve(int maxEval, UnivariateRealFunction function, double min, double max, double startValue)
-        throws ConvergenceException, MathUserException, IllegalArgumentException {
+        throws ConvergenceException, FunctionEvaluationException, IllegalArgumentException {
         throw MathRuntimeException.createUnsupportedOperationException(LocalizedFormats.NOT_OVERRIDEN);
     }
 
@@ -225,11 +225,11 @@ public abstract class UnivariateRealSolv
      * @param upper  the upper endpoint
      * @param function the function
      * @return true if f(lower) * f(upper) < 0
-     * @throws MathUserException if an error occurs evaluating the function at the endpoints
+     * @throws FunctionEvaluationException if an error occurs evaluating the function at the endpoints
      */
     protected boolean isBracketing(final double lower, final double upper,
                                    final UnivariateRealFunction function)
-        throws MathUserException {
+        throws FunctionEvaluationException {
         final double f1 = function.value(lower);
         final double f2 = function.value(upper);
         return (f1 > 0 && f2 < 0) || (f1 < 0 && f2 > 0);
@@ -288,11 +288,11 @@ public abstract class UnivariateRealSolv
      * @param upper upper endpoint
      * @param function function
      * @throws IllegalArgumentException
-     * @throws MathUserException if an error occurs evaluating the function at the endpoints
+     * @throws FunctionEvaluationException if an error occurs evaluating the function at the endpoints
      */
     protected void verifyBracketing(final double lower, final double upper,
                                     final UnivariateRealFunction function)
-        throws MathUserException {
+        throws FunctionEvaluationException {
 
         verifyInterval(lower, upper);
         if (!isBracketing(lower, upper, function)) {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java Tue Feb 15 01:31:12 2011
@@ -17,10 +17,10 @@
 package org.apache.commons.math.analysis.solvers;
 
 import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.FunctionEvaluationException;
 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.exception.MathUserException;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.util.FastMath;
 
@@ -47,12 +47,12 @@ public class UnivariateRealSolverUtils {
      * @param x1 the upper bound for the interval.
      * @return a value where the function is zero.
      * @throws ConvergenceException if the iteration count was exceeded
-     * @throws MathUserException if an error occurs evaluating the function
+     * @throws FunctionEvaluationException if an error occurs evaluating the function
      * @throws IllegalArgumentException if f is null or the endpoints do not
      * specify a valid interval
      */
     public static double solve(UnivariateRealFunction f, double x0, double x1)
-    throws ConvergenceException, MathUserException {
+    throws ConvergenceException, FunctionEvaluationException {
         setup(f);
         return LazyHolder.FACTORY.newDefaultSolver().solve(f, x0, x1);
     }
@@ -67,14 +67,14 @@ public class UnivariateRealSolverUtils {
      * @param absoluteAccuracy the accuracy to be used by the solver
      * @return a value where the function is zero
      * @throws ConvergenceException if the iteration count is exceeded
-     * @throws MathUserException if an error occurs evaluating the function
+     * @throws FunctionEvaluationException if an error occurs evaluating the function
      * @throws IllegalArgumentException if f is null, the endpoints do not
      * specify a valid interval, or the absoluteAccuracy is not valid for the
      * default solver
      */
     public static double solve(UnivariateRealFunction f, double x0, double x1,
             double absoluteAccuracy) throws ConvergenceException,
-            MathUserException {
+            FunctionEvaluationException {
 
         setup(f);
         UnivariateRealSolver solver = LazyHolder.FACTORY.newDefaultSolver();
@@ -118,13 +118,13 @@ public class UnivariateRealSolverUtils {
      * value)
      * @return a two element array holding {a, b}
      * @throws ConvergenceException if a root can not be bracketted
-     * @throws MathUserException if an error occurs evaluating the function
+     * @throws FunctionEvaluationException if an error occurs evaluating the function
      * @throws IllegalArgumentException if function is null, maximumIterations
      * is not positive, or initial is not between lowerBound and upperBound
      */
     public static double[] bracket(UnivariateRealFunction function,
             double initial, double lowerBound, double upperBound)
-    throws ConvergenceException, MathUserException {
+    throws ConvergenceException, FunctionEvaluationException {
         return bracket( function, initial, lowerBound, upperBound,
             Integer.MAX_VALUE ) ;
     }
@@ -158,14 +158,14 @@ public class UnivariateRealSolverUtils {
      * @return a two element array holding {a, b}.
      * @throws ConvergenceException if the algorithm fails to find a and b
      * satisfying the desired conditions
-     * @throws MathUserException if an error occurs evaluating the function
+     * @throws FunctionEvaluationException if an error occurs evaluating the function
      * @throws IllegalArgumentException if function is null, maximumIterations
      * is not positive, or initial is not between lowerBound and upperBound
      */
     public static double[] bracket(UnivariateRealFunction function,
             double initial, double lowerBound, double upperBound,
             int maximumIterations) throws ConvergenceException,
-            MathUserException {
+            FunctionEvaluationException {
 
         if (function == null) {
             throw new NullArgumentException(LocalizedFormats.FUNCTION);

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java Tue Feb 15 01:31:12 2011
@@ -20,9 +20,9 @@ package org.apache.commons.math.linear;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.exception.MathUnsupportedOperationException;
 import org.apache.commons.math.exception.DimensionMismatchException;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.analysis.BinaryFunction;
 import org.apache.commons.math.analysis.ComposableFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
@@ -156,7 +156,7 @@ public abstract class AbstractRealVector
         if (d != 0) {
             try {
                 return mapToSelf(BinaryFunction.ADD.fix1stArgument(d));
-            } catch (MathUserException e) {
+            } catch (FunctionEvaluationException e) {
                 throw new IllegalArgumentException(e);
             }
         }
@@ -354,7 +354,7 @@ public abstract class AbstractRealVector
     public RealVector mapAbsToSelf() {
         try {
             return mapToSelf(ComposableFunction.ABS);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -368,7 +368,7 @@ public abstract class AbstractRealVector
     public RealVector mapAcosToSelf() {
         try {
             return mapToSelf(ComposableFunction.ACOS);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -382,7 +382,7 @@ public abstract class AbstractRealVector
     public RealVector mapAsinToSelf() {
         try {
             return mapToSelf(ComposableFunction.ASIN);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -396,7 +396,7 @@ public abstract class AbstractRealVector
     public RealVector mapAtanToSelf() {
         try {
             return mapToSelf(ComposableFunction.ATAN);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -410,7 +410,7 @@ public abstract class AbstractRealVector
     public RealVector mapCbrtToSelf() {
         try {
             return mapToSelf(ComposableFunction.CBRT);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -424,7 +424,7 @@ public abstract class AbstractRealVector
     public RealVector mapCeilToSelf() {
         try {
             return mapToSelf(ComposableFunction.CEIL);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -438,7 +438,7 @@ public abstract class AbstractRealVector
     public RealVector mapCosToSelf() {
         try {
             return mapToSelf(ComposableFunction.COS);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -452,7 +452,7 @@ public abstract class AbstractRealVector
     public RealVector mapCoshToSelf() {
         try {
             return mapToSelf(ComposableFunction.COSH);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -466,7 +466,7 @@ public abstract class AbstractRealVector
     public RealVector mapDivideToSelf(double d){
         try {
             return mapToSelf(BinaryFunction.DIVIDE.fix2ndArgument(d));
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -480,7 +480,7 @@ public abstract class AbstractRealVector
     public RealVector mapExpToSelf() {
         try {
             return mapToSelf(ComposableFunction.EXP);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -494,7 +494,7 @@ public abstract class AbstractRealVector
     public RealVector mapExpm1ToSelf() {
         try {
             return mapToSelf(ComposableFunction.EXPM1);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -508,7 +508,7 @@ public abstract class AbstractRealVector
     public RealVector mapFloorToSelf() {
         try {
             return mapToSelf(ComposableFunction.FLOOR);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -522,7 +522,7 @@ public abstract class AbstractRealVector
     public RealVector mapInvToSelf() {
         try {
             return mapToSelf(ComposableFunction.INVERT);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -536,7 +536,7 @@ public abstract class AbstractRealVector
     public RealVector mapLogToSelf() {
         try {
             return mapToSelf(ComposableFunction.LOG);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -550,7 +550,7 @@ public abstract class AbstractRealVector
     public RealVector mapLog10ToSelf() {
         try {
             return mapToSelf(ComposableFunction.LOG10);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -564,7 +564,7 @@ public abstract class AbstractRealVector
     public RealVector mapLog1pToSelf() {
         try {
             return mapToSelf(ComposableFunction.LOG1P);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -578,7 +578,7 @@ public abstract class AbstractRealVector
     public RealVector mapMultiplyToSelf(double d){
         try {
             return mapToSelf(BinaryFunction.MULTIPLY.fix1stArgument(d));
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -592,7 +592,7 @@ public abstract class AbstractRealVector
     public RealVector mapPowToSelf(double d){
         try {
             return mapToSelf(BinaryFunction.POW.fix2ndArgument(d));
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -606,7 +606,7 @@ public abstract class AbstractRealVector
     public RealVector mapRintToSelf() {
         try {
             return mapToSelf(ComposableFunction.RINT);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -620,7 +620,7 @@ public abstract class AbstractRealVector
     public RealVector mapSignumToSelf() {
         try {
             return mapToSelf(ComposableFunction.SIGNUM);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -634,7 +634,7 @@ public abstract class AbstractRealVector
     public RealVector mapSinToSelf() {
         try {
             return mapToSelf(ComposableFunction.SIN);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -648,7 +648,7 @@ public abstract class AbstractRealVector
     public RealVector mapSinhToSelf() {
         try {
             return mapToSelf(ComposableFunction.SINH);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -662,7 +662,7 @@ public abstract class AbstractRealVector
     public RealVector mapSqrtToSelf() {
         try {
             return mapToSelf(ComposableFunction.SQRT);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -686,7 +686,7 @@ public abstract class AbstractRealVector
     public RealVector mapTanToSelf() {
         try {
             return mapToSelf(ComposableFunction.TAN);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -700,7 +700,7 @@ public abstract class AbstractRealVector
     public RealVector mapTanhToSelf() {
         try {
             return mapToSelf(ComposableFunction.TANH);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -714,7 +714,7 @@ public abstract class AbstractRealVector
     public RealVector mapUlpToSelf() {
         try {
             return mapToSelf(ComposableFunction.ULP);
-        } catch (MathUserException e) {
+        } catch (FunctionEvaluationException e) {
             throw new IllegalArgumentException(e);
         }
     }
@@ -823,12 +823,12 @@ public abstract class AbstractRealVector
     }
 
     /** {@inheritDoc} */
-    public RealVector map(UnivariateRealFunction function) throws MathUserException {
+    public RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException {
         return copy().mapToSelf(function);
     }
 
     /** {@inheritDoc} */
-    public RealVector mapToSelf(UnivariateRealFunction function) throws MathUserException {
+    public RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException {
         Iterator<Entry> it = (function.value(0) == 0) ? sparseIterator() : iterator();
         Entry e;
         while (it.hasNext() && (e = it.next()) != null) {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/MatrixVisitorException.java Tue Feb 15 01:31:12 2011
@@ -17,18 +17,15 @@
 
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.exception.util.DummyLocalizable;
 import org.apache.commons.math.exception.util.Localizable;
 
 /**
  * Thrown when a visitor encounters an error while processing a matrix entry.
  * @version $Revision$ $Date$
- * @deprecated in 2.2 (to be removed in 3.0). Please use
- * {@link org.apache.commons.math.exception.MathUserException} instead.
  */
-@Deprecated
-public class MatrixVisitorException extends MathUserException {
+public class MatrixVisitorException extends MathRuntimeException {
 
     /** Serializable version identifier */
     private static final long serialVersionUID = 3814333035048617048L;
@@ -37,9 +34,7 @@ public class MatrixVisitorException exte
      * Constructs a new instance with specified formatted detail message.
      * @param pattern format specifier
      * @param arguments format arguments
-     * @deprecated as of 2.2 replaced by {@link #MatrixVisitorException(Localizable, Object...)}
      */
-    @Deprecated
     public MatrixVisitorException(final String pattern, final Object[] arguments) {
       super(new DummyLocalizable(pattern), arguments);
     }

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java Tue Feb 15 01:31:12 2011
@@ -18,8 +18,8 @@ package org.apache.commons.math.linear;
 
 import java.util.Iterator;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.exception.MathUserException;
 
 
 /**
@@ -63,9 +63,9 @@ public interface RealVector {
      *
      * @param function Function to apply to each entry.
      * @return this vector.
-     * @throws MathUserException if the function throws it.
+     * @throws FunctionEvaluationException if the function throws it.
      */
-    RealVector mapToSelf(UnivariateRealFunction function) throws MathUserException;
+    RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException;
 
     /**
      * Acts as if implemented as:
@@ -73,11 +73,11 @@ public interface RealVector {
      *  return copy().map(function);
      * </pre>
      *
-     * @param function Functin to apply to each entry.
+     * @param function Function to apply to each entry.
      * @return a new vector.
-     * @throws MathUserException if the function throws it.
+     * @throws FunctionEvaluationException if the function throws it.
      */
-    RealVector map(UnivariateRealFunction function) throws MathUserException;
+    RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException;
 
     /** Class representing a modifiable entry in the vector. */
     public abstract class Entry {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/ode/events/EventState.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/ode/events/EventState.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/ode/events/EventState.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/ode/events/EventState.java Tue Feb 15 01:31:12 2011
@@ -18,6 +18,7 @@
 package org.apache.commons.math.ode.events;
 
 import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.solvers.BrentSolver;
 import org.apache.commons.math.exception.MathInternalError;
@@ -249,7 +250,11 @@ public class EventState {
                         final double epsilon = (forward ? 0.25 : -0.25) * convergence;
                         for (int k = 0; (k < 4) && (ga * gb > 0); ++k) {
                             ta += epsilon;
-                            ga = f.value(ta);
+                            try {
+                                ga = f.value(ta);
+                            } catch (FunctionEvaluationException ex) {
+                                throw new MathUserException(ex);
+                            }
                         }
                         if (ga * gb > 0) {
                             // this should never happen
@@ -257,9 +262,14 @@ public class EventState {
                         }
                     }
 
-                    final double root = (ta <= tb) ?
-                                        solver.solve(maxIterationCount, f, ta, tb) :
-                                        solver.solve(maxIterationCount, f, tb, ta);
+                    final double root;
+                    try {
+                        root = (ta <= tb) ?
+                                solver.solve(maxIterationCount, f, ta, tb) :
+                                    solver.solve(maxIterationCount, f, tb, ta);
+                    } catch (FunctionEvaluationException ex) {
+                        throw new MathUserException(ex);
+                    }
 
                     if ((!Double.isNaN(previousEventTime)) &&
                         (FastMath.abs(root - ta) <= convergence) &&

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java Tue Feb 15 01:31:12 2011
@@ -17,10 +17,10 @@
 
 package org.apache.commons.math.optimization;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.linear.RealMatrix;
 
@@ -99,7 +99,7 @@ public class LeastSquaresConverter imple
      * </p>
      * <p>
      * The array computed by the objective function, the observations array and the
-     * weights array must have consistent sizes or a {@link MathUserException} will be
+     * weights array must have consistent sizes or a {@link FunctionEvaluationException} will be
      * triggered while computing the scalar objective.
      * </p>
      * @param function vectorial residuals function to wrap
@@ -132,7 +132,7 @@ public class LeastSquaresConverter imple
      * </p>
      * <p>
      * The array computed by the objective function, the observations array and the
-     * the scaling matrix must have consistent sizes or a {@link MathUserException}
+     * the scaling matrix must have consistent sizes or a {@link FunctionEvaluationException}
      * will be triggered while computing the scalar objective.
      * </p>
      * @param function vectorial residuals function to wrap
@@ -157,12 +157,12 @@ public class LeastSquaresConverter imple
     }
 
     /** {@inheritDoc} */
-    public double value(final double[] point) throws MathUserException {
+    public double value(final double[] point) throws FunctionEvaluationException {
 
         // compute residuals
         final double[] residuals = function.value(point);
         if (residuals.length != observations.length) {
-            throw new MathUserException(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
+            throw new FunctionEvaluationException(point,LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                         residuals.length, observations.length);
         }
         for (int i = 0; i < residuals.length; ++i) {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.java Tue Feb 15 01:31:12 2011
@@ -18,9 +18,9 @@
 package org.apache.commons.math.optimization;
 
 import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.random.RandomGenerator;
 import org.apache.commons.math.util.FastMath;
@@ -226,7 +226,7 @@ public class MultiStartUnivariateRealOpt
     /** {@inheritDoc} */
     public double optimize(final UnivariateRealFunction f, final GoalType goalType,
                            final double min, final double max)
-        throws ConvergenceException, MathUserException {
+        throws ConvergenceException, FunctionEvaluationException {
 
         optima           = new double[starts];
         optimaValues     = new double[starts];
@@ -245,7 +245,7 @@ public class MultiStartUnivariateRealOpt
                                                      FastMath.min(bound1, bound2),
                                                      FastMath.max(bound1, bound2));
                 optimaValues[i] = optimizer.getFunctionValue();
-            } catch (MathUserException fee) {
+            } catch (FunctionEvaluationException fee) {
                 optima[i]       = Double.NaN;
                 optimaValues[i] = Double.NaN;
             } catch (ConvergenceException ce) {
@@ -312,7 +312,7 @@ public class MultiStartUnivariateRealOpt
     /** {@inheritDoc} */
     public double optimize(final UnivariateRealFunction f, final GoalType goalType,
                            final double min, final double max, final double startValue)
-            throws ConvergenceException, MathUserException {
+            throws ConvergenceException, FunctionEvaluationException {
         return optimize(f, goalType, min, max);
     }
 }

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/UnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/UnivariateRealOptimizer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/UnivariateRealOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/UnivariateRealOptimizer.java Tue Feb 15 01:31:12 2011
@@ -17,9 +17,9 @@
 package org.apache.commons.math.optimization;
 
 import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.ConvergingAlgorithm;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.exception.MathUserException;
 
 
 /**
@@ -63,13 +63,13 @@ public interface UnivariateRealOptimizer
      * @return a value where the function is optimum.
      * @throws ConvergenceException if the maximum iteration count is exceeded
      * or the optimizer detects convergence problems otherwise.
-     * @throws MathUserException if an error occurs evaluating the function.
+     * @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 optimizer.
      */
     double optimize(UnivariateRealFunction f, GoalType goalType,
                     double min, double max)
-        throws ConvergenceException, MathUserException;
+        throws ConvergenceException, FunctionEvaluationException;
 
     /**
      * Find an optimum in the given interval, start at startValue.
@@ -85,13 +85,13 @@ public interface UnivariateRealOptimizer
      * @return a value where the function is optimum.
      * @throws ConvergenceException if the maximum iteration count is exceeded
      * or the optimizer detects convergence problems otherwise.
-     * @throws MathUserException if an error occurs evaluating the function.
+     * @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 optimizer.
      */
     double optimize(UnivariateRealFunction f, GoalType goalType,
                     double min, double max, double startValue)
-        throws ConvergenceException, MathUserException;
+        throws ConvergenceException, FunctionEvaluationException;
 
     /**
      * Get the result of the last run of the optimizer.
@@ -106,10 +106,10 @@ public interface UnivariateRealOptimizer
      * Get the result of the last run of the optimizer.
      *
      * @return the value of the function at the optimum.
-     * @throws MathUserException if an error occurs evaluating the function.
+     * @throws FunctionEvaluationException if an error occurs evaluating the function.
      * @throws IllegalStateException if there is no result available, either
      * because no result was yet computed or the last attempt failed.
      */
-    double getFunctionValue() throws MathUserException;
+    double getFunctionValue() throws FunctionEvaluationException;
 
 }

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java Tue Feb 15 01:31:12 2011
@@ -20,11 +20,11 @@ package org.apache.commons.math.optimiza
 import java.util.Arrays;
 import java.util.Comparator;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxEvaluationsExceededException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.MultivariateRealOptimizer;
@@ -257,7 +257,7 @@ public abstract class DirectSearchOptimi
     public RealPointValuePair optimize(final MultivariateRealFunction function,
                                        final GoalType goalType,
                                        final double[] startPoint)
-        throws MathUserException, OptimizationException, IllegalArgumentException {
+        throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {
 
         if ((startConfiguration == null) ||
             (startConfiguration.length != startPoint.length)) {
@@ -321,27 +321,27 @@ public abstract class DirectSearchOptimi
 
     /** Compute the next simplex of the algorithm.
      * @param comparator comparator to use to sort simplex vertices from best to worst
-     * @exception MathUserException if the function cannot be evaluated at
+     * @exception FunctionEvaluationException if the function cannot be evaluated at
      * some point
      * @exception OptimizationException if the algorithm fails to converge
      * @exception IllegalArgumentException if the start point dimension is wrong
      */
     protected abstract void iterateSimplex(final Comparator<RealPointValuePair> comparator)
-        throws MathUserException, OptimizationException, IllegalArgumentException;
+        throws FunctionEvaluationException, OptimizationException, IllegalArgumentException;
 
     /** Evaluate the objective function on one point.
      * <p>A side effect of this method is to count the number of
      * function evaluations</p>
      * @param x point on which the objective function should be evaluated
      * @return objective function value at the given point
-     * @exception MathUserException if no value can be computed for the
+     * @exception FunctionEvaluationException if no value can be computed for the
      * parameters or if the maximal number of evaluations is exceeded
      * @exception IllegalArgumentException if the start point dimension is wrong
      */
     protected double evaluate(final double[] x)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
         if (++evaluations > maxEvaluations) {
-            throw new MathUserException(new MaxEvaluationsExceededException(maxEvaluations));
+            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations), x);
         }
         return f.value(x);
     }
@@ -378,11 +378,11 @@ public abstract class DirectSearchOptimi
 
     /** Evaluate all the non-evaluated points of the simplex.
      * @param comparator comparator to use to sort simplex vertices from best to worst
-     * @exception MathUserException if no value can be computed for the parameters
+     * @exception FunctionEvaluationException if no value can be computed for the parameters
      * @exception OptimizationException if the maximal number of evaluations is exceeded
      */
     protected void evaluateSimplex(final Comparator<RealPointValuePair> comparator)
-        throws MathUserException, OptimizationException {
+        throws FunctionEvaluationException, OptimizationException {
 
         // evaluate the objective function at all non-evaluated simplex points
         for (int i = 0; i < simplex.length; ++i) {

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java Tue Feb 15 01:31:12 2011
@@ -19,7 +19,7 @@ package org.apache.commons.math.optimiza
 
 import java.util.Comparator;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.optimization.OptimizationException;
 import org.apache.commons.math.optimization.RealConvergenceChecker;
 import org.apache.commons.math.optimization.RealPointValuePair;
@@ -59,7 +59,7 @@ public class MultiDirectional extends Di
     /** {@inheritDoc} */
     @Override
     protected void iterateSimplex(final Comparator<RealPointValuePair> comparator)
-        throws MathUserException, OptimizationException, IllegalArgumentException {
+        throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {
 
         final RealConvergenceChecker checker = getConvergenceChecker();
         while (true) {
@@ -112,13 +112,13 @@ public class MultiDirectional extends Di
      * @param coeff linear coefficient
      * @param comparator comparator to use to sort simplex vertices from best to poorest
      * @return best point in the transformed simplex
-     * @exception MathUserException if the function cannot be evaluated at some point
+     * @exception FunctionEvaluationException if the function cannot be evaluated at some point
      * @exception OptimizationException if the maximal number of evaluations is exceeded
      */
     private RealPointValuePair evaluateNewSimplex(final RealPointValuePair[] original,
                                               final double coeff,
                                               final Comparator<RealPointValuePair> comparator)
-        throws MathUserException, OptimizationException {
+        throws FunctionEvaluationException, OptimizationException {
 
         final double[] xSmallest = original[0].getPointRef();
         final int n = xSmallest.length;

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java Tue Feb 15 01:31:12 2011
@@ -19,7 +19,7 @@ package org.apache.commons.math.optimiza
 
 import java.util.Comparator;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.optimization.OptimizationException;
 import org.apache.commons.math.optimization.RealPointValuePair;
 
@@ -72,7 +72,7 @@ public class NelderMead extends DirectSe
     /** {@inheritDoc} */
     @Override
     protected void iterateSimplex(final Comparator<RealPointValuePair> comparator)
-        throws MathUserException, OptimizationException {
+        throws FunctionEvaluationException, OptimizationException {
 
         incrementIterationsCounter();
 

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java Tue Feb 15 01:31:12 2011
@@ -20,7 +20,6 @@ package org.apache.commons.math.optimiza
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.FunctionEvaluationException;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.OptimizationException;
 import org.apache.commons.math.optimization.RealPointValuePair;
@@ -232,11 +231,11 @@ public class PowellOptimizer
          *
          * @param p Starting point.
          * @param d Search direction.
-         * @throws MathUserException if function cannot be evaluated at some test point
+         * @throws FunctionEvaluationException if function cannot be evaluated at some test point
          * @throws OptimizationException if algorithm fails to converge
          */
         public void search(final double[] p, final double[] d)
-            throws OptimizationException, MathUserException {
+            throws OptimizationException, FunctionEvaluationException {
 
             // Reset.
             optimum = Double.NaN;
@@ -246,18 +245,14 @@ public class PowellOptimizer
                 final int n = p.length;
                 final UnivariateRealFunction f = new UnivariateRealFunction() {
                         public double value(double alpha)
-                            throws MathUserException {
+                            throws FunctionEvaluationException {
 
                             final double[] x = new double[n];
                             for (int i = 0; i < n; i++) {
                                 x[i] = p[i] + alpha * d[i];
                             }
                             final double obj;
-                            try {
-                                obj = computeObjectiveValue(x);
-                            } catch (FunctionEvaluationException ex) {
-                                throw new MathUserException(ex);
-                            }
+                            obj = computeObjectiveValue(x);
                             return obj;
                         }
                     };

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java Tue Feb 15 01:31:12 2011
@@ -22,7 +22,6 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.solvers.BrentSolver;
 import org.apache.commons.math.analysis.solvers.UnivariateRealSolver;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.OptimizationException;
@@ -219,12 +218,12 @@ public class NonLinearConjugateGradientO
      * @param a lower bound of the interval
      * @param h initial step to try
      * @return b such that f(a) and f(b) have opposite signs
-     * @exception MathUserException if the function cannot be computed
+     * @exception FunctionEvaluationException if the function cannot be computed
      * @exception OptimizationException if no bracket can be found
      */
     private double findUpperBound(final UnivariateRealFunction f,
                                   final double a, final double h)
-        throws MathUserException, OptimizationException {
+        throws FunctionEvaluationException, OptimizationException {
         final double yA = f.value(a);
         double yB = yA;
         for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
@@ -268,7 +267,7 @@ public class NonLinearConjugateGradientO
         }
 
         /** {@inheritDoc} */
-        public double value(double x) throws MathUserException {
+        public double value(double x) throws FunctionEvaluationException {
 
             // current point in the search direction
             final double[] shiftedPoint = point.clone();
@@ -278,11 +277,7 @@ public class NonLinearConjugateGradientO
 
             // gradient of the objective function
             final double[] gradient;
-            try {
-                gradient = computeObjectiveGradient(shiftedPoint);
-            } catch (FunctionEvaluationException ex) {
-                throw new MathUserException(ex);
-            }
+            gradient = computeObjectiveGradient(shiftedPoint);
 
             // dot product with the search direction
             double dotProduct = 0;

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java Tue Feb 15 01:31:12 2011
@@ -18,10 +18,10 @@
 package org.apache.commons.math.optimization.univariate;
 
 import org.apache.commons.math.ConvergingAlgorithmImpl;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MaxEvaluationsExceededException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.MathUnsupportedOperationException;
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
@@ -103,7 +103,7 @@ public abstract class AbstractUnivariate
     }
 
     /** {@inheritDoc} */
-    public double getFunctionValue() throws MathUserException {
+    public double getFunctionValue() throws FunctionEvaluationException {
         if (Double.isNaN(functionValue)) {
             final double opt = getResult();
             functionValue = function.value(opt);
@@ -182,7 +182,7 @@ public abstract class AbstractUnivariate
      * @param f objective function
      * @param point point at which the objective function must be evaluated
      * @return objective function value at specified point
-     * @exception MathUserException if the function cannot be evaluated
+     * @exception FunctionEvaluationException if the function cannot be evaluated
      * or the maximal number of iterations is exceeded
      * @deprecated in 2.2. Use this {@link #computeObjectiveValue(double)
      * replacement} instead.
@@ -190,9 +190,9 @@ public abstract class AbstractUnivariate
     @Deprecated
     protected double computeObjectiveValue(final UnivariateRealFunction f,
                                            final double point)
-        throws MathUserException {
+        throws FunctionEvaluationException {
         if (++evaluations > maxEvaluations) {
-            throw new MathUserException(new MaxEvaluationsExceededException(maxEvaluations));
+            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations), point);
         }
         return f.value(point);
     }
@@ -202,14 +202,14 @@ public abstract class AbstractUnivariate
      *
      * @param point Point at which the objective function must be evaluated.
      * @return the objective function value at specified point.
-     * @exception MathUserException if the function cannot be evaluated
+     * @exception FunctionEvaluationException if the function cannot be evaluated
      * or the maximal number of iterations is exceeded.
      */
     protected double computeObjectiveValue(double point)
-        throws MathUserException {
+        throws FunctionEvaluationException {
         if (++evaluations > maxEvaluations) {
             resultComputed = false;
-            throw new MathUserException(new MaxEvaluationsExceededException(maxEvaluations));
+            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations), point);
         }
         return function.value(point);
     }
@@ -217,7 +217,7 @@ public abstract class AbstractUnivariate
     /** {@inheritDoc} */
     public double optimize(UnivariateRealFunction f, GoalType goal,
                            double min, double max, double startValue)
-        throws MaxIterationsExceededException, MathUserException {
+        throws MaxIterationsExceededException, FunctionEvaluationException {
         // Initialize.
         this.searchMin = min;
         this.searchMax = max;
@@ -249,7 +249,7 @@ public abstract class AbstractUnivariate
     /** {@inheritDoc} */
     public double optimize(UnivariateRealFunction f, GoalType goal,
                            double min, double max)
-        throws MaxIterationsExceededException, MathUserException {
+        throws MaxIterationsExceededException, FunctionEvaluationException {
         return optimize(f, goal, min, max, min + 0.5 * (max - min));
     }
 
@@ -265,11 +265,11 @@ public abstract class AbstractUnivariate
      * @return the optimum.
      * @throws MaxIterationsExceededException if the maximum iteration count
      * is exceeded.
-     * @throws MathUserException if an error occurs evaluating
+     * @throws FunctionEvaluationException if an error occurs evaluating
      * the function.
      */
     protected double doOptimize()
-        throws MaxIterationsExceededException, MathUserException {
+        throws MaxIterationsExceededException, FunctionEvaluationException {
         throw new MathUnsupportedOperationException(LocalizedFormats.NOT_OVERRIDEN);
     }
 }

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java Tue Feb 15 01:31:12 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.optimization.univariate;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
@@ -114,13 +114,13 @@ public class BracketFinder {
      * @param xB Initial point.
      * @throws MaxIterationsExceededException if the maximum iteration count
      * is exceeded.
-     * @throws MathUserException if an error occurs evaluating the function.
+     * @throws FunctionEvaluationException if an error occurs evaluating the function.
      */
     public void search(UnivariateRealFunction func,
                        GoalType goal,
                        double xA,
                        double xB)
-        throws MaxIterationsExceededException, MathUserException {
+        throws MaxIterationsExceededException, FunctionEvaluationException {
         reset();
         final boolean isMinim = goal == GoalType.MINIMIZE;
 
@@ -218,7 +218,7 @@ public class BracketFinder {
         return iterations;
     }
     /**
-     * @return the number of evalutations.
+     * @return the number of evaluations.
      */
     public int getEvaluations() {
         return evaluations;
@@ -276,10 +276,10 @@ public class BracketFinder {
      * @param f Function.
      * @param x Argument.
      * @return {@code f(x)}
-     * @throws MathUserException if function cannot be evaluated at x
+     * @throws FunctionEvaluationException if function cannot be evaluated at x
      */
     private double eval(UnivariateRealFunction f, double x)
-        throws MathUserException {
+        throws FunctionEvaluationException {
 
         ++evaluations;
         return f.value(x);

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java Tue Feb 15 01:31:12 2011
@@ -16,8 +16,8 @@
  */
 package org.apache.commons.math.optimization.univariate;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MaxIterationsExceededException;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.util.FastMath;
@@ -50,7 +50,7 @@ public class BrentOptimizer extends Abst
     /** {@inheritDoc} */
     @Override
     protected double doOptimize()
-        throws MaxIterationsExceededException, MathUserException {
+        throws MaxIterationsExceededException, FunctionEvaluationException {
         return localMin(getGoalType() == GoalType.MINIMIZE,
                         getMin(), getStartValue(), getMax(),
                         getRelativeAccuracy(), getAbsoluteAccuracy());
@@ -77,12 +77,12 @@ public class BrentOptimizer extends Abst
      * @return the optimum point.
      * @throws MaxIterationsExceededException if the maximum iteration count
      * is exceeded.
-     * @throws MathUserException if an error occurs evaluating the function.
+     * @throws FunctionEvaluationException if an error occurs evaluating the function.
      */
     private double localMin(boolean isMinim,
                             double lo, double mid, double hi,
                             double eps, double t)
-        throws MaxIterationsExceededException, MathUserException {
+        throws MaxIterationsExceededException, FunctionEvaluationException {
         if (eps <= 0) {
             throw new NotStrictlyPositiveException(eps);
         }

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Tue Feb 15 01:31:12 2011
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.math.transform;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.complex.Complex;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -76,13 +76,13 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform(UnivariateRealFunction f,
                               double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         return fct(data);
     }
@@ -117,13 +117,13 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform2(UnivariateRealFunction f,
                                double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         double scaling_coefficient = FastMath.sqrt(2.0 / (n-1));
@@ -159,12 +159,12 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws MathUserException if function cannot be evaluated at some point
+     * @throws FunctionEvaluationException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform(UnivariateRealFunction f,
                                      double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         double scaling_coefficient = 2.0 / (n - 1);
@@ -198,12 +198,12 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws MathUserException if function cannot be evaluated at some point
+     * @throws FunctionEvaluationException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform2(UnivariateRealFunction f,
                                       double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         return transform2(f, min, max, n);
     }

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java Tue Feb 15 01:31:12 2011
@@ -19,10 +19,10 @@ package org.apache.commons.math.transfor
 import java.io.Serializable;
 import java.lang.reflect.Array;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.complex.Complex;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -86,13 +86,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] transform(UnivariateRealFunction f,
                                double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
         double data[] = sample(f, min, max, n);
         return fft(data, false);
     }
@@ -141,13 +141,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] transform2(UnivariateRealFunction f,
                                 double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = sample(f, min, max, n);
         double scaling_coefficient = 1.0 / FastMath.sqrt(n);
@@ -200,13 +200,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex inversely transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] inversetransform(UnivariateRealFunction f,
                                       double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = sample(f, min, max, n);
         double scaling_coefficient = 1.0 / n;
@@ -259,13 +259,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex inversely transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] inversetransform2(UnivariateRealFunction f,
                                        double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = sample(f, min, max, n);
         double scaling_coefficient = 1.0 / FastMath.sqrt(n);
@@ -424,11 +424,11 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the samples array
-     * @throws MathUserException if function cannot be evaluated at some point
+     * @throws FunctionEvaluationException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public static double[] sample(UnivariateRealFunction f, double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         if (n <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java Tue Feb 15 01:31:12 2011
@@ -16,9 +16,9 @@
  */
 package org.apache.commons.math.transform;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
@@ -43,7 +43,7 @@ public class FastHadamardTransformer imp
     /** {@inheritDoc} */
     public double[] transform(UnivariateRealFunction f,
                               double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
         return fht(FastFourierTransformer.sample(f, min, max, n));
     }
 
@@ -56,7 +56,7 @@ public class FastHadamardTransformer imp
     /** {@inheritDoc} */
     public double[] inversetransform(UnivariateRealFunction f,
                                      double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
         final double[] unscaled =
             fht(FastFourierTransformer.sample(f, min, max, n));
         return FastFourierTransformer.scaleArray(unscaled, 1.0 / n);

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java Tue Feb 15 01:31:12 2011
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.math.transform;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.complex.Complex;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -75,13 +75,13 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform(UnivariateRealFunction f,
                               double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         data[0] = 0.0;
@@ -115,13 +115,13 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws MathUserException if function cannot be evaluated
+     * @throws FunctionEvaluationException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform2(
         UnivariateRealFunction f, double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         data[0] = 0.0;
@@ -156,11 +156,11 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws MathUserException if function cannot be evaluated at some point
+     * @throws FunctionEvaluationException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         data[0] = 0.0;
@@ -194,11 +194,11 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws MathUserException if function cannot be evaluated at some point
+     * @throws FunctionEvaluationException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform2(UnivariateRealFunction f, double min, double max, int n)
-        throws MathUserException, IllegalArgumentException {
+        throws FunctionEvaluationException, IllegalArgumentException {
 
         return transform2(f, min, max, n);
     }

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java Tue Feb 15 01:31:12 2011
@@ -16,8 +16,8 @@
  */
 package org.apache.commons.math.transform;
 
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.exception.MathUserException;
 
 /**
  * Interface for one-dimensional data sets transformations producing real results.
@@ -49,11 +49,11 @@ public interface RealTransformer  {
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws MathUserException if function cannot be evaluated at some point
+     * @throws FunctionEvaluationException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     double[] transform(UnivariateRealFunction f, double min, double max, int n)
-        throws MathUserException, IllegalArgumentException;
+        throws FunctionEvaluationException, IllegalArgumentException;
 
     /**
      * Inversely transform the given real data set.
@@ -71,10 +71,10 @@ public interface RealTransformer  {
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws MathUserException if function cannot be evaluated at some point
+     * @throws FunctionEvaluationException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
-        throws MathUserException, IllegalArgumentException;
+        throws FunctionEvaluationException, IllegalArgumentException;
 
 }

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java Tue Feb 15 01:31:12 2011
@@ -33,7 +33,7 @@ public class ArgumentOutsideDomainExcept
         assertNull(ex.getCause());
         assertNotNull(ex.getMessage());
         assertTrue(ex.getMessage().indexOf("3.14") > 0);
-        assertEquals(FastMath.PI, ex.getArgument().doubleValue(), 0);
+        assertEquals(FastMath.PI, ex.getArgument()[0], 0);
         assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
     }
 

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java Tue Feb 15 01:31:12 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -24,43 +23,43 @@ import org.junit.Test;
 public class BinaryFunctionTest {
 
     @Test
-    public void testAdd() throws MathUserException {
+    public void testAdd() throws Exception {
         Assert.assertEquals(5.0, BinaryFunction.ADD.value(2, 3), 1.0e-15);
         Assert.assertEquals(0.0, BinaryFunction.ADD.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testSubtract() throws MathUserException {
+    public void testSubtract() throws Exception {
         Assert.assertEquals(-1.0, BinaryFunction.SUBTRACT.value(2, 3), 1.0e-15);
         Assert.assertEquals(-2.0, BinaryFunction.SUBTRACT.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testMultiply() throws MathUserException {
+    public void testMultiply() throws Exception {
         Assert.assertEquals(6.0, BinaryFunction.MULTIPLY.value(2, 3), 1.0e-15);
         Assert.assertEquals(-1.0, BinaryFunction.MULTIPLY.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testDivide() throws MathUserException {
+    public void testDivide() throws Exception {
         Assert.assertEquals(1.5, BinaryFunction.DIVIDE.value(3, 2), 1.0e-15);
         Assert.assertEquals(-1.0, BinaryFunction.DIVIDE.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testPow() throws MathUserException {
+    public void testPow() throws Exception {
         Assert.assertEquals(9.0, BinaryFunction.POW.value(3, 2), 1.0e-15);
         Assert.assertEquals(-1.0, BinaryFunction.POW.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testAtan2() throws MathUserException {
+    public void testAtan2() throws Exception {
         Assert.assertEquals(FastMath.PI / 4, BinaryFunction.ATAN2.value(1, 1), 1.0e-15);
         Assert.assertEquals(-FastMath.PI / 4, BinaryFunction.ATAN2.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testFix1st() throws MathUserException {
+    public void testFix1st() throws Exception {
         ComposableFunction f = BinaryFunction.POW.fix1stArgument(2);
         for (double x = 0.0; x < 1.0; x += 0.01) {
             Assert.assertEquals(FastMath.pow(2.0, x), f.value(x), 1.0e-15);
@@ -68,7 +67,7 @@ public class BinaryFunctionTest {
     }
 
     @Test
-    public void testFix2nd() throws MathUserException {
+    public void testFix2nd() throws Exception {
         ComposableFunction f = BinaryFunction.POW.fix2ndArgument(2);
         for (double y = 0.0; y < 1.0; y += 0.01) {
             Assert.assertEquals(y * y, f.value(y), 1.0e-15);

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java Tue Feb 15 01:31:12 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -24,37 +24,37 @@ import org.junit.Test;
 public class ComposableFunctionTest {
 
     @Test
-    public void testZero() throws MathUserException {
+    public void testZero() throws Exception {
         Assert.assertEquals(0.0, ComposableFunction.ZERO.value(1), 1.0e-15);
         Assert.assertEquals(0.0, ComposableFunction.ZERO.value(2), 1.0e-15);
     }
 
     @Test
-    public void testOne() throws MathUserException {
+    public void testOne() throws Exception {
         Assert.assertEquals(1.0, ComposableFunction.ONE.value(1), 1.0e-15);
         Assert.assertEquals(1.0, ComposableFunction.ONE.value(2), 1.0e-15);
     }
 
     @Test
-    public void testIdentity() throws MathUserException {
+    public void testIdentity() throws Exception {
         Assert.assertEquals(1.0, ComposableFunction.IDENTITY.value(1), 1.0e-15);
         Assert.assertEquals(2.0, ComposableFunction.IDENTITY.value(2), 1.0e-15);
     }
 
     @Test
-    public void testRint() throws MathUserException {
+    public void testRint() throws Exception {
         Assert.assertEquals(1.0, ComposableFunction.RINT.value(0.9), 1.0e-15);
         Assert.assertEquals(2.0, ComposableFunction.RINT.value(2.2), 1.0e-15);
     }
 
     @Test
-    public void testSignum() throws MathUserException {
+    public void testSignum() throws Exception {
         Assert.assertEquals(1.0, ComposableFunction.SIGNUM.value(12.3), 1.0e-15);
         Assert.assertEquals(-1.0, ComposableFunction.SIGNUM.value(-6), 1.0e-15);
     }
 
     @Test
-    public void testComposition() throws MathUserException {
+    public void testComposition() throws Exception {
         ComposableFunction abs    = ComposableFunction.ABS;
         ComposableFunction acos   = ComposableFunction.ACOS;
         ComposableFunction asin   = ComposableFunction.ASIN;
@@ -104,7 +104,7 @@ public class ComposableFunctionTest {
     }
 
     @Test
-    public void testCombine() throws MathUserException {
+    public void testCombine() throws Exception {
 
         ComposableFunction f =
             ComposableFunction.COS.combine(ComposableFunction.ASIN, BinaryFunction.POW);
@@ -115,7 +115,7 @@ public class ComposableFunctionTest {
     }
 
     @Test
-    public void testSimpleCombination() throws MathUserException {
+    public void testSimpleCombination() throws Exception {
 
         ComposableFunction f1 = ComposableFunction.COS.add(3);
         ComposableFunction f2 = ComposableFunction.COS.add(ComposableFunction.SIN);
@@ -135,7 +135,7 @@ public class ComposableFunctionTest {
     }
 
     @Test
-    public void testCollector() throws MathUserException {
+    public void testCollector() throws Exception {
 
         ComposableFunction f = BinaryFunction.POW.fix2ndArgument(2);
         Assert.assertEquals(30, f.asCollector().value(new double[] { 1, 2, 3, 4 }), 1.0e-15);

Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java?rev=1070725&r1=1070724&r2=1070725&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java Tue Feb 15 01:31:12 2011
@@ -16,8 +16,7 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.exception.MathUserException;
-
+import org.apache.commons.math.FunctionEvaluationException;
 /**
  * Wrapper class for counting functions calls.
  *
@@ -38,7 +37,7 @@ public class MonitoredFunction implement
         return callsCount;
     }
 
-    public double value(double x) throws MathUserException {
+    public double value(double x) throws FunctionEvaluationException {
         ++callsCount;
         return f.value(x);
     }