commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r811685 [15/24] - in /commons/proper/math/trunk: ./ src/main/java/org/apache/commons/math/ src/main/java/org/apache/commons/math/analysis/ src/main/java/org/apache/commons/math/analysis/integration/ src/main/java/org/apache/commons/math/ana...
Date Sat, 05 Sep 2009 17:37:05 GMT
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SplineInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SplineInterpolatorTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SplineInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/SplineInterpolatorTest.java Sat Sep  5 17:36:48 2009
@@ -29,16 +29,16 @@
 /**
  * Test the SplineInterpolator.
  *
- * @version $Revision$ $Date$ 
+ * @version $Revision$ $Date$
  */
 public class SplineInterpolatorTest extends TestCase {
-    
+
     /** error tolerance for spline interpolator value at knot points */
     protected double knotTolerance = 1E-12;
-   
+
     /** error tolerance for interpolating polynomial coefficients */
     protected double coefficientTolerance = 1E-6;
-    
+
     /** error tolerance for interpolated values -- high value is from sin test */
     protected double interpolationTolerance = 1E-2;
 
@@ -60,14 +60,14 @@
         UnivariateRealFunction f = i.interpolate(x, y);
         verifyInterpolation(f, x, y);
         verifyConsistency((PolynomialSplineFunction) f, x);
-        
+
         // Verify coefficients using analytical values
         PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();
         double target[] = {y[0], 1d};
         TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);
         target = new double[]{y[1], 1d};
         TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);
-        
+
         // Check interpolation
         assertEquals(0.0,f.value(0.0), interpolationTolerance);
         assertEquals(0.4,f.value(0.4), interpolationTolerance);
@@ -81,7 +81,7 @@
         UnivariateRealInterpolator i = new SplineInterpolator();
         UnivariateRealFunction f = i.interpolate(x, y);
         verifyInterpolation(f, x, y);
-        
+
         // Verify coefficients using analytical values
         PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();
         double target[] = {y[0], 1d};
@@ -90,7 +90,7 @@
         TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);
         target = new double[]{y[2], 1d};
         TestUtils.assertEquals(polynomials[2].getCoefficients(), target, coefficientTolerance);
-        
+
         // Check interpolation
         assertEquals(0,f.value(0), interpolationTolerance);
         assertEquals(1.4,f.value(1.4), interpolationTolerance);
@@ -104,15 +104,15 @@
         UnivariateRealFunction f = i.interpolate(x, y);
         verifyInterpolation(f, x, y);
         verifyConsistency((PolynomialSplineFunction) f, x);
-        
+
         // Verify coefficients using analytical values
         PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();
         double target[] = {y[0], 1.5d, 0d, -2d};
         TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);
         target = new double[]{y[1], 0d, -3d, 2d};
-        TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);    
+        TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);
     }
-    
+
     public void testInterpolateSin() throws Exception {
         double x[] =
             {
@@ -130,15 +130,15 @@
         UnivariateRealFunction f = i.interpolate(x, y);
         verifyInterpolation(f, x, y);
         verifyConsistency((PolynomialSplineFunction) f, x);
-        
+
         /* Check coefficients against values computed using R (version 1.8.1, Red Hat Linux 9)
-         * 
+         *
          * To replicate in R:
          *     x[1] <- 0
          *     x[2] <- pi / 6, etc, same for y[] (could use y <- scan() for y values)
          *     g <- splinefun(x, y, "natural")
          *     splinecoef <- eval(expression(z), envir = environment(g))
-         *     print(splinecoef) 
+         *     print(splinecoef)
          */
         PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();
         double target[] = {y[0], 1.002676d, 0d, -0.17415829d};
@@ -156,13 +156,13 @@
         target = new double[]{y[6], 3.466465e-16, 5.471344e-01, -0.08707914};
         TestUtils.assertEquals(polynomials[6].getCoefficients(), target, coefficientTolerance);
         target = new double[]{y[7], 8.594367e-01, 2.735672e-01, -0.17415829};
-        TestUtils.assertEquals(polynomials[7].getCoefficients(), target, coefficientTolerance); 
-        
+        TestUtils.assertEquals(polynomials[7].getCoefficients(), target, coefficientTolerance);
+
         //Check interpolation
         assertEquals(Math.sqrt(2d) / 2d,f.value(Math.PI/4d),interpolationTolerance);
-        assertEquals(Math.sqrt(2d) / 2d,f.value(3d*Math.PI/4d),interpolationTolerance);     
+        assertEquals(Math.sqrt(2d) / 2d,f.value(3d*Math.PI/4d),interpolationTolerance);
     }
-    
+
 
     public void testIllegalArguments() throws MathException {
         // Data set arrays of different size.
@@ -183,32 +183,32 @@
         } catch (IllegalArgumentException iae) {
         }
     }
-    
+
     /**
      * verifies that f(x[i]) = y[i] for i = 0..n-1 where n is common length.
      */
-    protected void verifyInterpolation(UnivariateRealFunction f, double x[], double y[])  
+    protected void verifyInterpolation(UnivariateRealFunction f, double x[], double y[])
         throws Exception{
         for (int i = 0; i < x.length; i++) {
             assertEquals(f.value(x[i]), y[i], knotTolerance);
-        }     
+        }
     }
-    
+
     /**
      * Verifies that interpolating polynomials satisfy consistency requirement:
      *    adjacent polynomials must agree through two derivatives at knot points
      */
-    protected void verifyConsistency(PolynomialSplineFunction f, double x[]) 
+    protected void verifyConsistency(PolynomialSplineFunction f, double x[])
         throws Exception {
         PolynomialFunction polynomials[] = f.getPolynomials();
         for (int i = 1; i < x.length - 2; i++) {
-            // evaluate polynomials and derivatives at x[i + 1]  
-            assertEquals(polynomials[i].value(x[i +1] - x[i]), polynomials[i + 1].value(0), 0.1); 
-            assertEquals(polynomials[i].derivative().value(x[i +1] - x[i]), 
-                    polynomials[i + 1].derivative().value(0), 0.5); 
-            assertEquals(polynomials[i].polynomialDerivative().derivative().value(x[i +1] - x[i]), 
-                    polynomials[i + 1].polynomialDerivative().derivative().value(0), 0.5); 
+            // evaluate polynomials and derivatives at x[i + 1]
+            assertEquals(polynomials[i].value(x[i +1] - x[i]), polynomials[i + 1].value(0), 0.1);
+            assertEquals(polynomials[i].derivative().value(x[i +1] - x[i]),
+                    polynomials[i + 1].derivative().value(0), 0.5);
+            assertEquals(polynomials[i].polynomialDerivative().derivative().value(x[i +1] - x[i]),
+                    polynomials[i + 1].polynomialDerivative().derivative().value(0), 0.5);
         }
     }
-    
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java Sat Sep  5 17:36:48 2009
@@ -26,7 +26,7 @@
  * give us the exact same polynomial as result. Thus we can use a very
  * small tolerance to account only for round-off errors.
  *
- * @version $Revision$ $Date$ 
+ * @version $Revision$ $Date$
  */
 public final class PolynomialFunctionLagrangeFormTest extends TestCase {
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonFormTest.java Sat Sep  5 17:36:48 2009
@@ -24,7 +24,7 @@
  * <p>
  * The small tolerance number is used only to account for round-off errors.
  *
- * @version $Revision$ $Date$ 
+ * @version $Revision$ $Date$
  */
 public final class PolynomialFunctionNewtonFormTest extends TestCase {
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionTest.java Sat Sep  5 17:36:48 2009
@@ -48,10 +48,10 @@
         assertEquals( f.value( -123.5), c[0], tolerance );
         assertEquals( f.value( 3.0), c[0], tolerance );
         assertEquals( f.value( 456.89), c[0], tolerance );
-        
+
         assertEquals(f.degree(), 0);
         assertEquals(f.derivative().value(0), 0, tolerance);
-        
+
         assertEquals(f.polynomialDerivative().derivative().value(0), 0, tolerance);
     }
 
@@ -59,7 +59,7 @@
      * tests the value of a linear polynomial.
      *
      * <p>This will test the function f(x) = 3*x - 1.5</p>
-     * <p>This will have the values 
+     * <p>This will have the values
      *  <tt>f(0.0) = -1.5, f(-1.0) = -4.5, f(-2.5) = -9.0,
      *      f(0.5) = 0.0, f(1.5) = 3.0</tt> and <tt>f(3.0) = 7.5</tt>
      * </p>
@@ -77,11 +77,11 @@
         assertEquals( 0.0, f.value( 0.5), tolerance );
         assertEquals( 3.0, f.value( 1.5), tolerance );
         assertEquals( 7.5, f.value( 3.0), tolerance );
-        
+
         assertEquals(f.degree(), 1);
-        
+
         assertEquals(f.polynomialDerivative().derivative().value(0), 0, tolerance);
-    
+
     }
 
 
@@ -103,12 +103,12 @@
         assertEquals( -2.0, f.value( 1.5), tolerance );
         assertEquals( 7.0, f.value( -1.5), tolerance );
         assertEquals( 265.5312, f.value( 12.34), tolerance );
-    
-    }    
+
+    }
 
 
-    /** 
-     * This will test the quintic function 
+    /**
+     * This will test the quintic function
      *   f(x) = x^2(x-5)(x+3)(x-1) = x^5 - 3x^4 -13x^3 + 15x^2</p>
      *
      */
@@ -125,16 +125,16 @@
         assertEquals( 0.0, f.value( -3.0), tolerance );
         assertEquals( 54.84375, f.value( -1.5), tolerance );
         assertEquals( -8.06637, f.value( 1.3), tolerance );
-        
+
         assertEquals(f.degree(), 5);
-    
-    }    
+
+    }
 
 
     /**
      * tests the firstDerivative function by comparison
      *
-     * <p>This will test the functions 
+     * <p>This will test the functions
      * <tt>f(x) = x^3 - 2x^2 + 6x + 3, g(x) = 3x^2 - 4x + 6</tt>
      * and <tt>h(x) = 6x - 4</tt>
      */
@@ -230,7 +230,7 @@
         PolynomialFunction p2 = new PolynomialFunction(new double[] { 3.0, 2.0, 1.0 });
         assertEquals(p2, TestUtils.serializeAndRecover(p2));
     }
-    
+
     public void checkPolynomial(PolynomialFunction p, String reference) {
         assertEquals(reference, p.toString());
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java Sat Sep  5 17:36:48 2009
@@ -31,52 +31,52 @@
 
     /** Error tolerance for tests */
     protected double tolerance = 1.0e-12;
-    
-    /** 
-     * Quadratic polynomials used in tests: 
-     * 
+
+    /**
+     * Quadratic polynomials used in tests:
+     *
      * x^2 + x            [-1, 0)
      * x^2 + x + 2        [0, 1)
      * x^2 + x + 4        [1, 2)
-     * 
+     *
      * Defined so that evaluation using PolynomialSplineFunction evaluation
      * algorithm agrees at knot point boundaries.
      */
     protected PolynomialFunction[] polynomials = {
-        new PolynomialFunction(new double[] {0d, 1d, 1d}), 
+        new PolynomialFunction(new double[] {0d, 1d, 1d}),
         new PolynomialFunction(new double[] {2d, 1d, 1d}),
         new PolynomialFunction(new double[] {4d, 1d, 1d})
     };
-    
+
     /** Knot points  */
     protected double[] knots = {-1, 0, 1, 2};
-    
+
     /** Derivative of test polynomials -- 2x + 1  */
-    protected PolynomialFunction dp = 
+    protected PolynomialFunction dp =
         new PolynomialFunction(new double[] {1d, 2d});
-    
-    
+
+
     public void testConstructor() {
-        PolynomialSplineFunction spline = 
+        PolynomialSplineFunction spline =
             new PolynomialSplineFunction(knots, polynomials);
         assertTrue(Arrays.equals(knots, spline.getKnots()));
         assertEquals(1d, spline.getPolynomials()[0].getCoefficients()[2], 0);
         assertEquals(3, spline.getN());
-        
+
         try { // too few knots
             new PolynomialSplineFunction(new double[] {0}, polynomials);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         try { // too many knots
             new PolynomialSplineFunction(new double[] {0,1,2,3,4}, polynomials);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         try { // knots not increasing
             new PolynomialSplineFunction(new double[] {0,1, 3, 2}, polynomials);
             fail("Expecting IllegalArgumentException");
@@ -84,15 +84,15 @@
             // expected
         }
     }
-    
+
     public void testValues() throws Exception {
-        PolynomialSplineFunction spline = 
+        PolynomialSplineFunction spline =
             new PolynomialSplineFunction(knots, polynomials);
         UnivariateRealFunction dSpline = spline.derivative();
-        
+
         /**
          * interior points -- spline value at x should equal p(x - knot)
-         * where knot is the largest knot point less than or equal to x and p 
+         * where knot is the largest knot point less than or equal to x and p
          * is the polynomial defined over the knot segment to which x belongs.
          */
         double x = -1;
@@ -100,12 +100,12 @@
         for (int i = 0; i < 10; i++) {
            x+=0.25;
            index = findKnot(knots, x);
-           assertEquals("spline function evaluation failed for x=" + x, 
+           assertEquals("spline function evaluation failed for x=" + x,
                    polynomials[index].value(x - knots[index]), spline.value(x), tolerance);
            assertEquals("spline derivative evaluation failed for x=" + x,
                    dp.value(x - knots[index]), dSpline.value(x), tolerance);
         }
-        
+
         // knot points -- centering should zero arguments
         for (int i = 0; i < 3; i++) {
             assertEquals("spline function evaluation failed for knot=" + knots[i],
@@ -113,22 +113,22 @@
             assertEquals("spline function evaluation failed for knot=" + knots[i],
                     dp.value(0), dSpline.value(knots[i]), tolerance);
         }
-        
+
         try { //outside of domain -- under min
             x = spline.value(-1.5);
             fail("Expecting IllegalArgumentException");
         } catch (FunctionEvaluationException ex) {
             // expected
         }
-        
+
         try { //outside of domain -- over max
             x = spline.value(2.5);
             fail("Expecting IllegalArgumentException");
         } catch (FunctionEvaluationException ex) {
             // expected
-        }         
-    }  
-    
+        }
+    }
+
     /**
      *  Do linear search to find largest knot point less than or equal to x.
      *  Implementation does binary search.
@@ -145,4 +145,4 @@
          throw new IllegalArgumentException("x is out of range");
      }
 }
-    
+

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=811685&r1=811684&r2=811685&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 Sep  5 17:36:48 2009
@@ -32,7 +32,7 @@
     public void testDeprecated() throws MathException {
         UnivariateRealFunction f = new SinFunction();
         double result;
-        
+
         UnivariateRealSolver solver = new BisectionSolver(f);
         result = solver.solve(3, 4);
         assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
@@ -44,7 +44,7 @@
     public void testSinZero() throws MathException {
         UnivariateRealFunction f = new SinFunction();
         double result;
-        
+
         UnivariateRealSolver solver = new BisectionSolver();
         result = solver.solve(f, 3, 4);
         assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
@@ -90,67 +90,67 @@
 
         result = solver.solve(f, 0.85, 5);
         assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
-        
+
         assertEquals(result, solver.getResult(), 0);
         assertTrue(solver.getIterationCount() > 0);
     }
-    
+
     /**
-     * 
+     *
      */
     public void testSetFunctionValueAccuracy(){
-        double expected = 1.0e-2;    
+        double expected = 1.0e-2;
         UnivariateRealSolver solver = new BisectionSolver();
         solver.setFunctionValueAccuracy(expected);
         assertEquals(expected, solver.getFunctionValueAccuracy(), 1.0e-2);
-    }        
-    
+    }
+
     /**
-     * 
+     *
      */
     public void testResetFunctionValueAccuracy(){
-        double newValue = 1.0e-2;    
+        double newValue = 1.0e-2;
         UnivariateRealSolver solver = new BisectionSolver();
         double oldValue = solver.getFunctionValueAccuracy();
         solver.setFunctionValueAccuracy(newValue);
         solver.resetFunctionValueAccuracy();
         assertEquals(oldValue, solver.getFunctionValueAccuracy(), 1.0e-2);
-    }        
-    
+    }
+
     /**
-     * 
+     *
      */
     public void testSetAbsoluteAccuracy(){
-        double expected = 1.0e-2; 
+        double expected = 1.0e-2;
         UnivariateRealSolver solver = new BisectionSolver();
         solver.setAbsoluteAccuracy(expected);
-        assertEquals(expected, solver.getAbsoluteAccuracy(), 1.0e-2); 
-    }        
-    
+        assertEquals(expected, solver.getAbsoluteAccuracy(), 1.0e-2);
+    }
+
     /**
-     * 
+     *
      */
     public void testResetAbsoluteAccuracy(){
-        double newValue = 1.0e-2;       
+        double newValue = 1.0e-2;
         UnivariateRealSolver solver = new BisectionSolver();
         double oldValue = solver.getAbsoluteAccuracy();
         solver.setAbsoluteAccuracy(newValue);
         solver.resetAbsoluteAccuracy();
         assertEquals(oldValue, solver.getAbsoluteAccuracy(), 1.0e-2);
-    }        
-    
+    }
+
     /**
-     * 
+     *
      */
     public void testSetMaximalIterationCount(){
         int expected = 100;
         UnivariateRealSolver solver = new BisectionSolver();
         solver.setMaximalIterationCount(expected);
         assertEquals(expected, solver.getMaximalIterationCount());
-    }        
-    
+    }
+
     /**
-     * 
+     *
      */
     public void testResetMaximalIterationCount(){
         int newValue = 10000;
@@ -159,29 +159,29 @@
         solver.setMaximalIterationCount(newValue);
         solver.resetMaximalIterationCount();
         assertEquals(oldValue, solver.getMaximalIterationCount());
-    }        
-    
+    }
+
     /**
-     * 
+     *
      */
     public void testSetRelativeAccuracy(){
         double expected = 1.0e-2;
         UnivariateRealSolver solver = new BisectionSolver();
         solver.setRelativeAccuracy(expected);
         assertEquals(expected, solver.getRelativeAccuracy(), 1.0e-2);
-    }        
-    
+    }
+
     /**
-     * 
+     *
      */
     public void testResetRelativeAccuracy(){
-        double newValue = 1.0e-2;        
+        double newValue = 1.0e-2;
         UnivariateRealSolver solver = new BisectionSolver();
         double oldValue = solver.getRelativeAccuracy();
         solver.setRelativeAccuracy(newValue);
         solver.resetRelativeAccuracy();
         assertEquals(oldValue, solver.getRelativeAccuracy(), 1.0e-2);
-    }        
-    
-   
+    }
+
+
 }

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=811685&r1=811684&r2=811685&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 Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,8 +34,8 @@
  * regressions. On average Brent-Dekker should use 4..5 iterations for the
  * default absolute accuracy of 10E-8 for sinus and the quintic function around
  * zero, and 5..10 iterations for the other zeros.
- * 
- * @version $Revision:670469 $ $Date:2008-06-23 10:01:38 +0200 (lun., 23 juin 2008) $ 
+ *
+ * @version $Revision:670469 $ $Date:2008-06-23 10:01:38 +0200 (lun., 23 juin 2008) $
  */
 public final class BrentSolverTest extends TestCase {
 
@@ -53,7 +53,7 @@
     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. 
+        // still converge quadratically.
         UnivariateRealFunction f = new SinFunction();
         double result;
         UnivariateRealSolver solver = new BrentSolver(f);
@@ -90,7 +90,7 @@
     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
-        // still converge quadratically. 
+        // still converge quadratically.
         UnivariateRealFunction f = new SinFunction();
         double result;
         UnivariateRealSolver solver = new BrentSolver();
@@ -309,11 +309,11 @@
         result = UnivariateRealSolverUtils.solve(f, 0.85, 5);
         assertEquals(result, 1.0, 1E-6);
     }
-    
+
     public void testRootEndpoints() throws Exception {
         UnivariateRealFunction f = new SinFunction();
         UnivariateRealSolver solver = new BrentSolver();
-        
+
         // endpoint is root
         double result = solver.solve(f, Math.PI, 4);
         assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
@@ -321,7 +321,7 @@
         result = solver.solve(f, 3, Math.PI);
         assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
     }
-    
+
     public void testBadEndpoints() throws Exception {
         UnivariateRealFunction f = new SinFunction();
         UnivariateRealSolver solver = new BrentSolver();
@@ -350,7 +350,7 @@
         assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
         int referenceCallsCount = f.getCallsCount();
         assertTrue(referenceCallsCount >= 13);
- 
+
         // invalid guess (it *is* a root, but outside of the range)
         try {
           result = solver.solve(f, 0.6, 7.0, 0.0);
@@ -360,13 +360,13 @@
         } catch (Exception e) {
             fail("wrong exception caught: " + e.getMessage());
         }
- 
+
         // bad guess
         f.setCallsCount(0);
         result = solver.solve(f, 0.6, 7.0, 0.61);
         assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
         assertTrue(f.getCallsCount() > referenceCallsCount);
- 
+
         // good guess
         f.setCallsCount(0);
         result = solver.solve(f, 0.6, 7.0, 0.999999);
@@ -379,7 +379,7 @@
         assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
         assertEquals(0, solver.getIterationCount());
         assertEquals(1, f.getCallsCount());
- 
+
     }
-    
+
 }

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=811685&r1=811684&r2=811685&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 Sep  5 17:36:48 2009
@@ -30,8 +30,8 @@
  * show that for a default absolute accuracy of 1E-6, it generally takes
  * less than 5 iterations to find one root, provided solveAll() is not
  * invoked, and 15 to 20 iterations to find all roots for quintic function.
- * 
- * @version $Revision$ $Date$ 
+ *
+ * @version $Revision$ $Date$
  */
 public final class LaguerreSolverTest extends TestCase {
 
@@ -157,7 +157,7 @@
         tolerance = Math.max(solver.getAbsoluteAccuracy(),
                     Math.abs(expected.abs() * solver.getRelativeAccuracy()));
         TestUtils.assertContains(result, expected, tolerance);
-        
+
         expected = new Complex(0.5, -0.5 * Math.sqrt(3.0));
         tolerance = Math.max(solver.getAbsoluteAccuracy(),
                     Math.abs(expected.abs() * solver.getRelativeAccuracy()));

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=811685&r1=811684&r2=811685&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 Sep  5 17:36:48 2009
@@ -34,8 +34,8 @@
  * <p>
  * Tests for the exponential function illustrate the situations where
  * Muller solver performs poorly.
- * 
- * @version $Revision$ $Date$ 
+ *
+ * @version $Revision$ $Date$
  */
 public final class MullerSolverTest extends TestCase {
 

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=811685&r1=811684&r2=811685&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 Sep  5 17:36:48 2009
@@ -33,14 +33,14 @@
     public void testDeprecated() throws MathException {
         DifferentiableUnivariateRealFunction f = new SinFunction();
         double result;
-        
+
         UnivariateRealSolver solver = new NewtonSolver(f);
         result = solver.solve(3, 4);
         assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
 
         result = solver.solve(1, 4);
         assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
-        
+
         assertEquals(result, solver.getResult(), 0);
         assertTrue(solver.getIterationCount() > 0);
     }
@@ -51,14 +51,14 @@
    public void testSinZero() throws MathException {
        DifferentiableUnivariateRealFunction f = new SinFunction();
        double result;
-       
+
        UnivariateRealSolver solver = new NewtonSolver();
        result = solver.solve(f, 3, 4);
        assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
 
        result = solver.solve(f, 1, 4);
        assertEquals(result, Math.PI, solver.getAbsoluteAccuracy());
-       
+
        assertEquals(result, solver.getResult(), 0);
        assertTrue(solver.getIterationCount() > 0);
    }
@@ -104,5 +104,5 @@
         result = solver.solve(f, 0.85, 5);
         assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
     }
-    
+
 }

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=811685&r1=811684&r2=811685&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 Sep  5 17:36:48 2009
@@ -32,8 +32,8 @@
  * accuracy of 1E-6, it generally takes less than 5 iterations for close
  * initial bracket and 5 to 10 iterations for distant initial bracket
  * to converge.
- * 
- * @version $Revision$ $Date$ 
+ *
+ * @version $Revision$ $Date$
  */
 public final class RiddersSolverTest extends TestCase {
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactoryImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactoryImplTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactoryImplTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactoryImplTest.java Sat Sep  5 17:36:48 2009
@@ -24,10 +24,10 @@
  * @version $Revision$ $Date$
  */
 public class UnivariateRealSolverFactoryImplTest extends TestCase {
-    
+
     /** solver factory */
     private UnivariateRealSolverFactory factory;
-    
+
     /**
      * @throws java.lang.Exception
      * @see junit.framework.TestCase#tearDown()
@@ -37,7 +37,7 @@
         super.setUp();
         factory = new UnivariateRealSolverFactoryImpl();
     }
-    
+
     /**
      * @throws java.lang.Exception
      * @see junit.framework.TestCase#tearDown()

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,9 +27,9 @@
  * @version $Revision$ $Date$
  */
 public class UnivariateRealSolverUtilsTest extends TestCase {
-    
+
     protected UnivariateRealFunction sin = new SinFunction();
-    
+
     public void testSolveNull() throws MathException {
         try {
             UnivariateRealSolverUtils.solve(null, 0.0, 4.0);
@@ -38,25 +38,25 @@
             // success
         }
     }
-    
+
     public void testSolveBadParameters() throws MathException {
         try { // bad endpoints
-            UnivariateRealSolverUtils.solve(sin,0.0, 4.0, 4.0); 
+            UnivariateRealSolverUtils.solve(sin,0.0, 4.0, 4.0);
         } catch (IllegalArgumentException ex) {
             // expected
-        }    
+        }
         try { // bad accuracy
-            UnivariateRealSolverUtils.solve(sin, 0.0, 4.0, 0.0); 
+            UnivariateRealSolverUtils.solve(sin, 0.0, 4.0, 0.0);
         } catch (IllegalArgumentException ex) {
             // expected
-        }        
+        }
     }
-    
-    public void testSolveSin() throws MathException {     
+
+    public void testSolveSin() throws MathException {
         double x = UnivariateRealSolverUtils.solve(sin, 1.0, 4.0);
         assertEquals(Math.PI, x, 1.0e-4);
     }
-    
+
     public void testSolveAccuracyNull()  throws MathException {
         try {
             double accuracy = 1.0e-6;
@@ -66,36 +66,36 @@
             // success
         }
     }
-    
+
     public void testSolveAccuracySin() throws MathException {
         double accuracy = 1.0e-6;
         double x = UnivariateRealSolverUtils.solve(sin, 1.0,
                 4.0, accuracy);
         assertEquals(Math.PI, x, accuracy);
     }
-    
+
     public void testSolveNoRoot() throws MathException {
         try {
-            UnivariateRealSolverUtils.solve(sin, 1.0, 1.5);  
-            fail("Expecting IllegalArgumentException ");  
+            UnivariateRealSolverUtils.solve(sin, 1.0, 1.5);
+            fail("Expecting IllegalArgumentException ");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
-    
+
     public void testBracketSin() throws MathException {
-        double[] result = UnivariateRealSolverUtils.bracket(sin, 
+        double[] result = UnivariateRealSolverUtils.bracket(sin,
                 0.0, -2.0, 2.0);
         assertTrue(sin.value(result[0]) < 0);
         assertTrue(sin.value(result[1]) > 0);
     }
-    
+
     public void testBracketEndpointRoot() throws MathException {
         double[] result = UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0);
         assertEquals(0.0, sin.value(result[0]), 1.0e-15);
         assertTrue(sin.value(result[1]) > 0);
     }
-    
+
     public void testBadParameters() throws MathException {
         try { // null function
             UnivariateRealSolverUtils.bracket(null, 1.5, 0, 2.0);
@@ -120,7 +120,7 @@
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
-        }        
+        }
     }
-    
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@
 import junit.framework.TestCase;
 
 public abstract class ComplexFormatAbstractTest extends TestCase {
- 
+
     CompositeFormat complexFormat = null;
     ComplexFormat complexFormatJ = null;
 
@@ -41,108 +41,108 @@
         complexFormatJ = ComplexFormat.getInstance(getLocale());
         complexFormatJ.setImaginaryCharacter("j");
     }
-   
+
     public void testSimpleNoDecimals() {
         Complex c = new Complex(1, 1);
         String expected = "1 + 1i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testSimpleWithDecimals() {
         Complex c = new Complex(1.23, 1.43);
         String expected = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testSimpleWithDecimalsTrunc() {
         Complex c = new Complex(1.2323, 1.4343);
         String expected = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testNegativeReal() {
         Complex c = new Complex(-1.2323, 1.4343);
         String expected = "-1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testNegativeImaginary() {
         Complex c = new Complex(1.2323, -1.4343);
         String expected = "1" + getDecimalCharacter() + "23 - 1" + getDecimalCharacter() + "43i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testNegativeBoth() {
         Complex c = new Complex(-1.2323, -1.4343);
         String expected = "-1" + getDecimalCharacter() + "23 - 1" + getDecimalCharacter() + "43i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testZeroReal() {
         Complex c = new Complex(0.0, -1.4343);
         String expected = "0 - 1" + getDecimalCharacter() + "43i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testZeroImaginary() {
         Complex c = new Complex(30.233, 0);
         String expected = "30" + getDecimalCharacter() + "23";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testDifferentImaginaryChar() {
         Complex c = new Complex(1, 1);
         String expected = "1 + 1j";
-        String actual = complexFormatJ.format(c); 
+        String actual = complexFormatJ.format(c);
         assertEquals(expected, actual);
     }
-    
+
     public void testStaticFormatComplex() {
         Locale defaultLocal = Locale.getDefault();
         Locale.setDefault(getLocale());
-        
+
         Complex c = new Complex(232.222, -342.33);
         String expected = "232" + getDecimalCharacter() + "22 - 342" + getDecimalCharacter() + "33i";
-        String actual = ComplexFormat.formatComplex(c); 
+        String actual = ComplexFormat.formatComplex(c);
         assertEquals(expected, actual);
-        
+
         Locale.setDefault(defaultLocal);
     }
 
     public void testNan() {
         Complex c = new Complex(Double.NaN, Double.NaN);
         String expected = "(NaN) + (NaN)i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testPositiveInfinity() {
         Complex c = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
         String expected = "(Infinity) + (Infinity)i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
 
     public void testNegativeInfinity() {
         Complex c = new Complex(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
         String expected = "(-Infinity) - (Infinity)i";
-        String actual = complexFormat.format(c); 
+        String actual = complexFormat.format(c);
         assertEquals(expected, actual);
     }
-    
+
     public void testParseSimpleNoDecimals() {
         String source = "1 + 1i";
         Complex expected = new Complex(1, 1);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -153,7 +153,7 @@
         String source = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
         Complex expected = new Complex(1.23, 1.43);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -164,7 +164,7 @@
         String source = "1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter() + "4343i";
         Complex expected = new Complex(1.2323, 1.4343);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -175,7 +175,7 @@
         String source = "-1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter() + "4343i";
         Complex expected = new Complex(-1.2323, 1.4343);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -186,7 +186,7 @@
         String source = "1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343i";
         Complex expected = new Complex(1.2323, -1.4343);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -197,7 +197,7 @@
         String source = "-1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343i";
         Complex expected = new Complex(-1.2323, -1.4343);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -208,7 +208,7 @@
         String source = "0" + getDecimalCharacter() + "0 - 1" + getDecimalCharacter() + "4343i";
         Complex expected = new Complex(0.0, -1.4343);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -219,7 +219,7 @@
         String source = "-1" + getDecimalCharacter() + "2323";
         Complex expected = new Complex(-1.2323, 0);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -230,18 +230,18 @@
         String source = "-1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343j";
         Complex expected = new Complex(-1.2323, -1.4343);
         try {
-            Complex actual = (Complex)complexFormatJ.parseObject(source); 
+            Complex actual = (Complex)complexFormatJ.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
         }
     }
-    
+
     public void testParseNan() {
         String source = "(NaN) + (NaN)i";
         Complex expected = new Complex(Double.NaN, Double.NaN);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -252,7 +252,7 @@
         String source = "(Infinity) + (Infinity)i";
         Complex expected = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
@@ -263,29 +263,29 @@
         String source = "(-Infinity) - (Infinity)i";
         Complex expected = new Complex(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
         try {
-            Complex actual = (Complex)complexFormat.parseObject(source); 
+            Complex actual = (Complex)complexFormat.parseObject(source);
             assertEquals(expected, actual);
         } catch (ParseException ex) {
             fail(ex.getMessage());
         }
     }
-    
+
     public void testConstructorSingleFormat() {
         NumberFormat nf = NumberFormat.getInstance();
         ComplexFormat cf = new ComplexFormat(nf);
         assertNotNull(cf);
         assertEquals(nf, cf.getRealFormat());
     }
-    
+
     public void testGetImaginaryFormat() {
         NumberFormat nf = NumberFormat.getInstance();
         ComplexFormat cf = new ComplexFormat();
-        
+
         assertNotSame(nf, cf.getImaginaryFormat());
         cf.setImaginaryFormat(nf);
         assertSame(nf, cf.getImaginaryFormat());
     }
-    
+
     public void testSetImaginaryFormatNull() {
         try {
             ComplexFormat cf = new ComplexFormat();
@@ -295,7 +295,7 @@
             // success
         }
     }
-    
+
     public void testSetRealFormatNull() {
         try {
             ComplexFormat cf = new ComplexFormat();
@@ -305,16 +305,16 @@
             // success
         }
     }
-    
+
     public void testGetRealFormat() {
         NumberFormat nf = NumberFormat.getInstance();
         ComplexFormat cf = new ComplexFormat();
-        
+
         assertNotSame(nf, cf.getRealFormat());
         cf.setRealFormat(nf);
         assertSame(nf, cf.getRealFormat());
     }
-    
+
     public void testSetImaginaryCharacterNull() {
         try {
             ComplexFormat cf = new ComplexFormat();
@@ -324,7 +324,7 @@
             // success
         }
     }
-    
+
     public void testSetImaginaryCharacterEmpty() {
         try {
             ComplexFormat cf = new ComplexFormat();
@@ -334,14 +334,14 @@
             // success
         }
     }
-    
+
     public void testFormatNumber() {
         CompositeFormat cf = ComplexFormat.getInstance(getLocale());
         Double pi = Double.valueOf(Math.PI);
         String text = cf.format(pi);
         assertEquals("3" + getDecimalCharacter() + "14", text);
     }
-    
+
     public void testFormatObject() {
         try {
             CompositeFormat cf = new ComplexFormat();

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFormatTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
     protected char getDecimalCharacter() {
         return '.';
     }
-    
+
     @Override
     protected Locale getLocale() {
         return Locale.US;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@
  * @version $Revision$ $Date$
  */
 public class ComplexTest extends TestCase {
-    
+
 
     private double inf = Double.POSITIVE_INFINITY;
     private double neginf = Double.NEGATIVE_INFINITY;
@@ -51,13 +51,13 @@
     private Complex nanInf = new Complex(nan, inf);
     private Complex nanNegInf = new Complex(nan, neginf);
     private Complex nanZero = new Complex(nan, 0);
-    
+
     public void testConstructor() {
         Complex z = new Complex(3.0, 4.0);
         assertEquals(3.0, z.getReal(), 1.0e-5);
         assertEquals(4.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testConstructorNaN() {
         Complex z = new Complex(3.0, Double.NaN);
         assertTrue(z.isNaN());
@@ -68,27 +68,27 @@
         z = new Complex(3.0, 4.0);
         assertFalse(z.isNaN());
     }
-    
+
     public void testAbs() {
         Complex z = new Complex(3.0, 4.0);
         assertEquals(5.0, z.abs(), 1.0e-5);
     }
-    
+
     public void testAbsNaN() {
         assertTrue(Double.isNaN(Complex.NaN.abs()));
         Complex z = new Complex(inf, nan);
         assertTrue(Double.isNaN(z.abs()));
     }
-    
+
     public void testAbsInfinite() {
         Complex z = new Complex(inf, 0);
         assertEquals(inf, z.abs(), 0);
         z = new Complex(0, neginf);
         assertEquals(inf, z.abs(), 0);
         z = new Complex(inf, neginf);
-        assertEquals(inf, z.abs(), 0);     
+        assertEquals(inf, z.abs(), 0);
     }
-    
+
     public void testAdd() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
@@ -96,7 +96,7 @@
         assertEquals(8.0, z.getReal(), 1.0e-5);
         assertEquals(10.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testAddNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.add(Complex.NaN);
@@ -106,37 +106,37 @@
         assertEquals(w.getReal(), 4.0, 0);
         assertTrue(Double.isNaN(w.getImaginary()));
     }
-    
+
     public void testAddInfinite() {
         Complex x = new Complex(1, 1);
         Complex z = new Complex(inf, 0);
         Complex w = x.add(z);
         assertEquals(w.getImaginary(), 1, 0);
         assertEquals(inf, w.getReal(), 0);
-        
+
         x = new Complex(neginf, 0);
         assertTrue(Double.isNaN(x.add(z).getReal()));
     }
-    
+
     public void testConjugate() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.conjugate();
         assertEquals(3.0, z.getReal(), 1.0e-5);
         assertEquals(-4.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testConjugateNaN() {
         Complex z = Complex.NaN.conjugate();
         assertTrue(z.isNaN());
     }
-    
+
     public void testConjugateInfiinite() {
         Complex z = new Complex(0, inf);
         assertEquals(neginf, z.conjugate().getImaginary(), 0);
         z = new Complex(0, neginf);
         assertEquals(inf, z.conjugate().getImaginary(), 0);
     }
-    
+
     public void testDivide() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
@@ -144,47 +144,47 @@
         assertEquals(39.0 / 61.0, z.getReal(), 1.0e-5);
         assertEquals(2.0 / 61.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testDivideInfinite() {
         Complex x = new Complex(3, 4);
         Complex w = new Complex(neginf, inf);
         assertTrue(x.divide(w).equals(Complex.ZERO));
-        
+
         Complex z = w.divide(x);
         assertTrue(Double.isNaN(z.getReal()));
         assertEquals(inf, z.getImaginary(), 0);
-        
+
         w = new Complex(inf, inf);
         z = w.divide(x);
         assertTrue(Double.isNaN(z.getImaginary()));
         assertEquals(inf, z.getReal(), 0);
-        
+
         w = new Complex(1, inf);
         z = w.divide(w);
         assertTrue(Double.isNaN(z.getReal()));
         assertTrue(Double.isNaN(z.getImaginary()));
     }
-    
+
     public void testDivideNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.divide(Complex.NaN);
         assertTrue(z.isNaN());
     }
-    
-    public void testDivideNaNInf() {  
+
+    public void testDivideNaNInf() {
        Complex z = oneInf.divide(Complex.ONE);
        assertTrue(Double.isNaN(z.getReal()));
        assertEquals(inf, z.getImaginary(), 0);
-       
+
        z = negInfNegInf.divide(oneNaN);
        assertTrue(Double.isNaN(z.getReal()));
        assertTrue(Double.isNaN(z.getImaginary()));
-       
+
        z = negInfInf.divide(Complex.ONE);
        assertTrue(Double.isNaN(z.getReal()));
        assertTrue(Double.isNaN(z.getImaginary()));
     }
-    
+
     public void testMultiply() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
@@ -192,13 +192,13 @@
         assertEquals(-9.0, z.getReal(), 1.0e-5);
         assertEquals(38.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testMultiplyNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.multiply(Complex.NaN);
         assertTrue(z.isNaN());
     }
-    
+
     public void testMultiplyNaNInf() {
         Complex z = new Complex(1,1);
         Complex w = z.multiply(infOne);
@@ -209,16 +209,16 @@
         assertTrue(new Complex( 1,0).multiply(infInf).equals(Complex.INF));
         assertTrue(new Complex(-1,0).multiply(infInf).equals(Complex.INF));
         assertTrue(new Complex( 1,0).multiply(negInfZero).equals(Complex.INF));
-        
+
         w = oneInf.multiply(oneNegInf);
         assertEquals(w.getReal(), inf, 0);
         assertEquals(w.getImaginary(), inf, 0);
-        
+
         w = negInfNegInf.multiply(oneNaN);
         assertTrue(Double.isNaN(w.getReal()));
-        assertTrue(Double.isNaN(w.getImaginary()));  
+        assertTrue(Double.isNaN(w.getImaginary()));
     }
-    
+
     public void testScalarMultiply() {
         Complex x = new Complex(3.0, 4.0);
         double y = 2.0;
@@ -226,13 +226,13 @@
         assertEquals(6.0, z.getReal(), 1.0e-5);
         assertEquals(8.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testScalarMultiplyNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.multiply(Double.NaN);
         assertTrue(z.isNaN());
     }
-    
+
     public void testScalarMultiplyInf() {
         Complex z = new Complex(1,1);
         Complex w = z.multiply(Double.POSITIVE_INFINITY);
@@ -243,19 +243,19 @@
         assertEquals(w.getReal(), inf, 0);
         assertEquals(w.getImaginary(), inf, 0);
     }
-    
+
     public void testNegate() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.negate();
         assertEquals(-3.0, z.getReal(), 1.0e-5);
         assertEquals(-4.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testNegateNaN() {
         Complex z = Complex.NaN.negate();
         assertTrue(z.isNaN());
     }
-    
+
     public void testSubtract() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
@@ -263,46 +263,46 @@
         assertEquals(-2.0, z.getReal(), 1.0e-5);
         assertEquals(-2.0, z.getImaginary(), 1.0e-5);
     }
-    
+
     public void testSubtractNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.subtract(Complex.NaN);
         assertTrue(z.isNaN());
     }
-    
+
     public void testEqualsNull() {
         Complex x = new Complex(3.0, 4.0);
         assertFalse(x.equals(null));
     }
-    
+
     public void testEqualsClass() {
         Complex x = new Complex(3.0, 4.0);
         assertFalse(x.equals(this));
     }
-    
+
     public void testEqualsSame() {
         Complex x = new Complex(3.0, 4.0);
         assertTrue(x.equals(x));
     }
-    
+
     public void testEqualsTrue() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(3.0, 4.0);
         assertTrue(x.equals(y));
     }
-    
+
     public void testEqualsRealDifference() {
         Complex x = new Complex(0.0, 0.0);
         Complex y = new Complex(0.0 + Double.MIN_VALUE, 0.0);
         assertFalse(x.equals(y));
     }
-    
+
     public void testEqualsImaginaryDifference() {
         Complex x = new Complex(0.0, 0.0);
         Complex y = new Complex(0.0, 0.0 + Double.MIN_VALUE);
         assertFalse(x.equals(y));
     }
-    
+
     public void testEqualsNaN() {
         Complex realNaN = new Complex(Double.NaN, 0.0);
         Complex imaginaryNaN = new Complex(0.0, Double.NaN);
@@ -311,7 +311,7 @@
         assertTrue(imaginaryNaN.equals(complexNaN));
         assertTrue(realNaN.equals(complexNaN));
     }
-    
+
     public void testHashCode() {
         Complex x = new Complex(0.0, 0.0);
         Complex y = new Complex(0.0, 0.0 + Double.MIN_VALUE);
@@ -323,15 +323,15 @@
         assertEquals(realNaN.hashCode(), imaginaryNaN.hashCode());
         assertEquals(imaginaryNaN.hashCode(), Complex.NaN.hashCode());
     }
-    
+
     public void testAcos() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(0.936812, -2.30551);
         TestUtils.assertEquals(expected, z.acos(), 1.0e-5);
-        TestUtils.assertEquals(new Complex(Math.acos(0), 0), 
+        TestUtils.assertEquals(new Complex(Math.acos(0), 0),
                 Complex.ZERO.acos(), 1.0e-12);
     }
-    
+
     public void testAcosInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.acos());
         TestUtils.assertSame(Complex.NaN, oneNegInf.acos());
@@ -342,21 +342,21 @@
         TestUtils.assertSame(Complex.NaN, negInfInf.acos());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.acos());
     }
-    
+
     public void testAcosNaN() {
         assertTrue(Complex.NaN.acos().isNaN());
     }
-    
+
     public void testAsin() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(0.633984, 2.30551);
         TestUtils.assertEquals(expected, z.asin(), 1.0e-5);
     }
-    
+
     public void testAsinNaN() {
         assertTrue(Complex.NaN.asin().isNaN());
     }
-    
+
     public void testAsinInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.asin());
         TestUtils.assertSame(Complex.NaN, oneNegInf.asin());
@@ -367,14 +367,14 @@
         TestUtils.assertSame(Complex.NaN, negInfInf.asin());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.asin());
     }
-    
-   
+
+
     public void testAtan() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(1.44831, 0.158997);
         TestUtils.assertEquals(expected, z.atan(), 1.0e-5);
     }
-    
+
     public void testAtanInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.atan());
         TestUtils.assertSame(Complex.NaN, oneNegInf.atan());
@@ -384,23 +384,23 @@
         TestUtils.assertSame(Complex.NaN, infNegInf.atan());
         TestUtils.assertSame(Complex.NaN, negInfInf.atan());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.atan());
-    } 
-    
+    }
+
     public void testAtanNaN() {
         assertTrue(Complex.NaN.atan().isNaN());
         assertTrue(Complex.I.atan().isNaN());
     }
-    
+
     public void testCos() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-27.03495, -3.851153);
         TestUtils.assertEquals(expected, z.cos(), 1.0e-5);
     }
-    
+
     public void testCosNaN() {
         assertTrue(Complex.NaN.cos().isNaN());
     }
-    
+
     public void testCosInf() {
         TestUtils.assertSame(infNegInf, oneInf.cos());
         TestUtils.assertSame(infInf, oneNegInf.cos());
@@ -410,19 +410,19 @@
         TestUtils.assertSame(Complex.NaN, infNegInf.cos());
         TestUtils.assertSame(Complex.NaN, negInfInf.cos());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.cos());
-    } 
-    
+    }
+
     public void testCosh() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-6.58066, -7.58155);
         TestUtils.assertEquals(expected, z.cosh(), 1.0e-5);
     }
-    
+
     public void testCoshNaN() {
         assertTrue(Complex.NaN.cosh().isNaN());
     }
-    
-    public void testCoshInf() {  
+
+    public void testCoshInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.cosh());
         TestUtils.assertSame(Complex.NaN, oneNegInf.cosh());
         TestUtils.assertSame(infInf, infOne.cosh());
@@ -431,23 +431,23 @@
         TestUtils.assertSame(Complex.NaN, infNegInf.cosh());
         TestUtils.assertSame(Complex.NaN, negInfInf.cosh());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.cosh());
-    } 
-    
+    }
+
     public void testExp() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-13.12878, -15.20078);
         TestUtils.assertEquals(expected, z.exp(), 1.0e-5);
-        TestUtils.assertEquals(Complex.ONE, 
+        TestUtils.assertEquals(Complex.ONE,
                 Complex.ZERO.exp(), 10e-12);
         Complex iPi = Complex.I.multiply(new Complex(pi,0));
-        TestUtils.assertEquals(Complex.ONE.negate(), 
+        TestUtils.assertEquals(Complex.ONE.negate(),
                 iPi.exp(), 10e-12);
     }
-    
+
     public void testExpNaN() {
         assertTrue(Complex.NaN.exp().isNaN());
     }
-    
+
     public void testExpInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.exp());
         TestUtils.assertSame(Complex.NaN, oneNegInf.exp());
@@ -458,17 +458,17 @@
         TestUtils.assertSame(Complex.NaN, negInfInf.exp());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.exp());
     }
-    
+
     public void testLog() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(1.60944, 0.927295);
         TestUtils.assertEquals(expected, z.log(), 1.0e-5);
     }
-    
+
     public void testLogNaN() {
         assertTrue(Complex.NaN.log().isNaN());
     }
-    
+
     public void testLogInf() {
         TestUtils.assertEquals(new Complex(inf, pi / 2),
                 oneInf.log(), 10e-12);
@@ -486,28 +486,28 @@
         TestUtils.assertEquals(new Complex(inf, - 3d * pi / 4),
                 negInfNegInf.log(), 10e-12);
     }
-    
+
     public void testLogZero() {
         TestUtils.assertSame(negInfZero, Complex.ZERO.log());
     }
-    
+
     public void testPow() {
         Complex x = new Complex(3, 4);
         Complex y = new Complex(5, 6);
         Complex expected = new Complex(-1.860893, 11.83677);
         TestUtils.assertEquals(expected, x.pow(y), 1.0e-5);
     }
-    
+
     public void testPowNaNBase() {
         Complex x = new Complex(3, 4);
         assertTrue(Complex.NaN.pow(x).isNaN());
     }
-    
+
     public void testPowNaNExponent() {
         Complex x = new Complex(3, 4);
         assertTrue(x.pow(Complex.NaN).isNaN());
     }
-    
+
    public void testPowInf() {
        TestUtils.assertSame(Complex.NaN,Complex.ONE.pow(oneInf));
        TestUtils.assertSame(Complex.NaN,Complex.ONE.pow(oneNegInf));
@@ -530,15 +530,15 @@
        TestUtils.assertSame(Complex.NaN,infInf.pow(infInf));
        TestUtils.assertSame(Complex.NaN,infNegInf.pow(infNegInf));
        TestUtils.assertSame(Complex.NaN,infNegInf.pow(negInfNegInf));
-       TestUtils.assertSame(Complex.NaN,infNegInf.pow(infInf));   
+       TestUtils.assertSame(Complex.NaN,infNegInf.pow(infInf));
    }
-   
+
    public void testPowZero() {
-       TestUtils.assertSame(Complex.NaN, 
+       TestUtils.assertSame(Complex.NaN,
                Complex.ZERO.pow(Complex.ONE));
-       TestUtils.assertSame(Complex.NaN, 
+       TestUtils.assertSame(Complex.NaN,
                Complex.ZERO.pow(Complex.ZERO));
-       TestUtils.assertSame(Complex.NaN, 
+       TestUtils.assertSame(Complex.NaN,
                Complex.ZERO.pow(Complex.I));
        TestUtils.assertEquals(Complex.ONE,
                Complex.ONE.pow(Complex.ZERO), 10e-12);
@@ -547,22 +547,22 @@
        TestUtils.assertEquals(Complex.ONE,
                new Complex(-1, 3).pow(Complex.ZERO), 10e-12);
    }
-    
+
     public void testpowNull() {
         try {
-            Complex.ONE.pow(null); 
+            Complex.ONE.pow(null);
             fail("Expecting NullPointerException");
         } catch (NullPointerException ex) {
             // expected
         }
     }
-    
+
     public void testSin() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(3.853738, -27.01681);
         TestUtils.assertEquals(expected, z.sin(), 1.0e-5);
     }
-    
+
     public void testSinInf() {
         TestUtils.assertSame(infInf, oneInf.sin());
         TestUtils.assertSame(infNegInf, oneNegInf.sin());
@@ -573,21 +573,21 @@
         TestUtils.assertSame(Complex.NaN, negInfInf.sin());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.sin());
     }
-    
+
     public void testSinNaN() {
         assertTrue(Complex.NaN.sin().isNaN());
     }
-    
+
     public void testSinh() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-6.54812, -7.61923);
         TestUtils.assertEquals(expected, z.sinh(), 1.0e-5);
     }
-    
+
     public void testSinhNaN() {
         assertTrue(Complex.NaN.sinh().isNaN());
     }
-    
+
     public void testSinhInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.sinh());
         TestUtils.assertSame(Complex.NaN, oneNegInf.sinh());
@@ -598,37 +598,37 @@
         TestUtils.assertSame(Complex.NaN, negInfInf.sinh());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.sinh());
     }
-    
+
     public void testSqrtRealPositive() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(2, 1);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
-    
+
     public void testSqrtRealZero() {
         Complex z = new Complex(0.0, 4);
         Complex expected = new Complex(1.41421, 1.41421);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
-    
+
     public void testSqrtRealNegative() {
         Complex z = new Complex(-3.0, 4);
         Complex expected = new Complex(1, 2);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
-    
+
     public void testSqrtImaginaryZero() {
         Complex z = new Complex(-3.0, 0.0);
         Complex expected = new Complex(0.0, 1.73205);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
-    
+
     public void testSqrtImaginaryNegative() {
         Complex z = new Complex(-3.0, -4.0);
         Complex expected = new Complex(1.0, -2.0);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
-    
+
     public void testSqrtPolar() {
         double r = 1;
         for (int i = 0; i < 5; i++) {
@@ -640,13 +640,13 @@
                 Complex sqrtz = ComplexUtils.polar2Complex(Math.sqrt(r), theta / 2);
                 TestUtils.assertEquals(sqrtz, z.sqrt(), 10e-12);
             }
-        }       
+        }
     }
-    
+
     public void testSqrtNaN() {
         assertTrue(Complex.NaN.sqrt().isNaN());
     }
-      
+
     public void testSqrtInf() {
         TestUtils.assertSame(infNaN, oneInf.sqrt());
         TestUtils.assertSame(infNaN, oneNegInf.sqrt());
@@ -657,27 +657,27 @@
         TestUtils.assertSame(nanInf, negInfInf.sqrt());
         TestUtils.assertSame(nanNegInf, negInfNegInf.sqrt());
     }
-    
+
     public void testSqrt1z() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(4.08033, -2.94094);
         TestUtils.assertEquals(expected, z.sqrt1z(), 1.0e-5);
     }
-    
+
     public void testSqrt1zNaN() {
         assertTrue(Complex.NaN.sqrt1z().isNaN());
     }
-    
+
     public void testTan() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-0.000187346, 0.999356);
         TestUtils.assertEquals(expected, z.tan(), 1.0e-5);
     }
-    
+
     public void testTanNaN() {
         assertTrue(Complex.NaN.tan().isNaN());
     }
-    
+
     public void testTanInf() {
         TestUtils.assertSame(zeroNaN, oneInf.tan());
         TestUtils.assertSame(zeroNaN, oneNegInf.tan());
@@ -688,22 +688,22 @@
         TestUtils.assertSame(Complex.NaN, negInfInf.tan());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.tan());
     }
-    
+
    public void testTanCritical() {
         TestUtils.assertSame(infNaN, new Complex(pi/2, 0).tan());
         TestUtils.assertSame(negInfNaN, new Complex(-pi/2, 0).tan());
     }
-    
+
     public void testTanh() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(1.00071, 0.00490826);
         TestUtils.assertEquals(expected, z.tanh(), 1.0e-5);
     }
-    
+
     public void testTanhNaN() {
         assertTrue(Complex.NaN.tanh().isNaN());
     }
-    
+
     public void testTanhInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.tanh());
         TestUtils.assertSame(Complex.NaN, oneNegInf.tanh());
@@ -714,7 +714,7 @@
         TestUtils.assertSame(Complex.NaN, negInfInf.tanh());
         TestUtils.assertSame(Complex.NaN, negInfNegInf.tanh());
     }
-    
+
     public void testTanhCritical() {
         TestUtils.assertSame(nanInf, new Complex(0, pi/2).tanh());
     }
@@ -723,8 +723,8 @@
     public void testMath221() {
         assertEquals(new Complex(0,-1), new Complex(0,1).multiply(new Complex(-1,0)));
     }
-    
-    /** 
+
+    /**
      * Test: computing <b>third roots</b> of z.
      * <pre>
      * <code>
@@ -743,7 +743,7 @@
         // Returned Collection must not be empty!
         assertEquals(3, thirdRootsOfZ.length);
         // test z_0
-        assertEquals(1.0,                  thirdRootsOfZ[0].getReal(),      1.0e-5); 
+        assertEquals(1.0,                  thirdRootsOfZ[0].getReal(),      1.0e-5);
         assertEquals(1.0,                  thirdRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
         assertEquals(-1.3660254037844386,  thirdRootsOfZ[1].getReal(),      1.0e-5);
@@ -754,7 +754,7 @@
     }
 
 
-    /** 
+    /**
      * Test: computing <b>fourth roots</b> of z.
      * <pre>
      * <code>
@@ -774,7 +774,7 @@
         // Returned Collection must not be empty!
         assertEquals(4, fourthRootsOfZ.length);
         // test z_0
-        assertEquals(1.5164629308487783,     fourthRootsOfZ[0].getReal(),      1.0e-5); 
+        assertEquals(1.5164629308487783,     fourthRootsOfZ[0].getReal(),      1.0e-5);
         assertEquals(-0.14469266210702247,   fourthRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
         assertEquals(0.14469266210702256,    fourthRootsOfZ[1].getReal(),      1.0e-5);
@@ -787,7 +787,7 @@
         assertEquals(-1.5164629308487783,    fourthRootsOfZ[3].getImaginary(), 1.0e-5);
     }
 
-    /** 
+    /**
      * Test: computing <b>third roots</b> of z.
      * <pre>
      * <code>
@@ -807,7 +807,7 @@
         // Returned Collection must not be empty!
         assertEquals(3, thirdRootsOfZ.length);
         // test z_0
-        assertEquals(2.0,                thirdRootsOfZ[0].getReal(),      1.0e-5); 
+        assertEquals(2.0,                thirdRootsOfZ[0].getReal(),      1.0e-5);
         assertEquals(0.0,                thirdRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
         assertEquals(-1.0,               thirdRootsOfZ[1].getReal(),      1.0e-5);
@@ -818,7 +818,7 @@
     }
 
 
-    /** 
+    /**
      * Test: computing <b>third roots</b> of z with real part 0.
      * <pre>
      * <code>
@@ -837,7 +837,7 @@
         // Returned Collection must not be empty!
         assertEquals(3, thirdRootsOfZ.length);
         // test z_0
-        assertEquals(1.0911236359717216,      thirdRootsOfZ[0].getReal(),      1.0e-5); 
+        assertEquals(1.0911236359717216,      thirdRootsOfZ[0].getReal(),      1.0e-5);
         assertEquals(0.6299605249474365,      thirdRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
         assertEquals(-1.0911236359717216,     thirdRootsOfZ[1].getReal(),      1.0e-5);
@@ -855,57 +855,57 @@
         List<Complex> roots = oneNaN.nthRoot(3);
         assertEquals(1,roots.size());
         assertEquals(Complex.NaN, roots.get(0));
-        
+
         roots = nanZero.nthRoot(3);
         assertEquals(1,roots.size());
         assertEquals(Complex.NaN, roots.get(0));
-        
+
         // NaN + infinite -> NaN
         roots = nanInf.nthRoot(3);
         assertEquals(1,roots.size());
         assertEquals(Complex.NaN, roots.get(0));
-        
+
         // finite + infinite -> Inf
         roots = oneInf.nthRoot(3);
         assertEquals(1,roots.size());
         assertEquals(Complex.INF, roots.get(0));
-        
+
         // infinite + infinite -> Inf
         roots = negInfInf.nthRoot(3);
         assertEquals(1,roots.size());
         assertEquals(Complex.INF, roots.get(0));
     }
-    
+
     /**
      * Test standard values
      */
     public void testGetArgument() {
         Complex z = new Complex(1, 0);
         assertEquals(0.0, z.getArgument(), 1.0e-12);
-        
+
         z = new Complex(1, 1);
         assertEquals(Math.PI/4, z.getArgument(), 1.0e-12);
-        
+
         z = new Complex(0, 1);
         assertEquals(Math.PI/2, z.getArgument(), 1.0e-12);
-        
+
         z = new Complex(-1, 1);
         assertEquals(3 * Math.PI/4, z.getArgument(), 1.0e-12);
-        
+
         z = new Complex(-1, 0);
         assertEquals(Math.PI, z.getArgument(), 1.0e-12);
-        
+
         z = new Complex(-1, -1);
         assertEquals(-3 * Math.PI/4, z.getArgument(), 1.0e-12);
-        
+
         z = new Complex(0, -1);
         assertEquals(-Math.PI/2, z.getArgument(), 1.0e-12);
-        
+
         z = new Complex(1, -1);
         assertEquals(-Math.PI/4, z.getArgument(), 1.0e-12);
-        
+
     }
-    
+
     /**
      * Verify atan2-style handling of infinite parts
      */
@@ -916,19 +916,19 @@
         assertEquals(Math.PI/2, zeroInf.getArgument(), 1.0e-12);
         assertEquals(0.0, infZero.getArgument(), 1.0e-12);
         assertEquals(Math.PI, negInfOne.getArgument(), 1.0e-12);
-        assertEquals(-3.0*Math.PI/4, negInfNegInf.getArgument(), 1.0e-12);  
-        assertEquals(-Math.PI/2, oneNegInf.getArgument(), 1.0e-12);        
+        assertEquals(-3.0*Math.PI/4, negInfNegInf.getArgument(), 1.0e-12);
+        assertEquals(-Math.PI/2, oneNegInf.getArgument(), 1.0e-12);
     }
-    
+
     /**
      * Verify that either part NaN results in NaN
      */
     public void testGetArgumentNaN() {
         assertEquals(nan, nanZero.getArgument());
         assertEquals(nan, zeroNaN.getArgument());
-        assertEquals(nan, Complex.NaN.getArgument());  
+        assertEquals(nan, Complex.NaN.getArgument());
     }
-    
+
     public void testSerial() {
         Complex z = new Complex(3.0, 4.0);
         assertEquals(z, TestUtils.serializeAndRecover(z));
@@ -947,7 +947,7 @@
         assertEquals(infInf, inftcmplx);
         assertTrue(inftcmplx.isInfinite());
     }
-    
+
     /**
      * Class to test extending Complex
      */
@@ -961,7 +961,7 @@
         public TestComplex(double real, double imaginary) {
             super(real, imaginary);
         }
-        
+
         public TestComplex(Complex other){
             this(other.getReal(), other.getImaginary());
         }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,12 +25,12 @@
  * @version $Revision$ $Date$
  */
 public class ComplexUtilsTest extends TestCase {
-    
+
     private double inf = Double.POSITIVE_INFINITY;
     private double negInf = Double.NEGATIVE_INFINITY;
     private double nan = Double.NaN;
     private double pi = Math.PI;
-    
+
     private Complex negInfInf = new Complex(negInf, inf);
     private Complex infNegInf = new Complex(inf, negInf);
     private Complex infInf = new Complex(inf, inf);
@@ -38,15 +38,15 @@
     private Complex infNaN = new Complex(inf, nan);
 
     public void testPolar2Complex() {
-        TestUtils.assertEquals(Complex.ONE, 
+        TestUtils.assertEquals(Complex.ONE,
                 ComplexUtils.polar2Complex(1, 0), 10e-12);
-        TestUtils.assertEquals(Complex.ZERO, 
+        TestUtils.assertEquals(Complex.ZERO,
                 ComplexUtils.polar2Complex(0, 1), 10e-12);
-        TestUtils.assertEquals(Complex.ZERO, 
+        TestUtils.assertEquals(Complex.ZERO,
                 ComplexUtils.polar2Complex(0, -1), 10e-12);
-        TestUtils.assertEquals(Complex.I, 
+        TestUtils.assertEquals(Complex.I,
                 ComplexUtils.polar2Complex(1, pi/2), 10e-12);
-        TestUtils.assertEquals(Complex.I.negate(), 
+        TestUtils.assertEquals(Complex.I.negate(),
                 ComplexUtils.polar2Complex(1, -pi/2), 10e-12);
         double r = 0;
         for (int i = 0; i < 5; i++) {
@@ -54,38 +54,38 @@
           double theta = 0;
           for (int j =0; j < 20; j++) {
               theta += pi / 6;
-              TestUtils.assertEquals(altPolar(r, theta), 
+              TestUtils.assertEquals(altPolar(r, theta),
                       ComplexUtils.polar2Complex(r, theta), 10e-12);
           }
           theta = -2 * pi;
           for (int j =0; j < 20; j++) {
               theta -= pi / 6;
-              TestUtils.assertEquals(altPolar(r, theta), 
+              TestUtils.assertEquals(altPolar(r, theta),
                       ComplexUtils.polar2Complex(r, theta), 10e-12);
           }
-        }   
+        }
     }
 
     protected Complex altPolar(double r, double theta) {
         return Complex.I.multiply(new Complex(theta, 0)).exp().multiply(new Complex(r, 0));
     }
-    
+
     public void testPolar2ComplexIllegalModulus() {
         try {
             ComplexUtils.polar2Complex(-1, 0);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
-        }       
+        }
     }
-    
+
     public void testPolar2ComplexNaN() {
         TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(nan, 1));
         TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(1, nan));
-        TestUtils.assertSame(Complex.NaN, 
-                ComplexUtils.polar2Complex(nan, nan));     
+        TestUtils.assertSame(Complex.NaN,
+                ComplexUtils.polar2Complex(nan, nan));
     }
-    
+
     public void testPolar2ComplexInf() {
         TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(1, inf));
         TestUtils.assertSame(Complex.NaN,

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/FrenchComplexFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/FrenchComplexFormatTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/FrenchComplexFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/FrenchComplexFormatTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.



Mime
View raw message