commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r694197 - in /commons/proper/math/branches/MATH_2_0/src: java/org/apache/commons/math/ode/nonstiff/ site/xdoc/ test/org/apache/commons/math/ode/nonstiff/
Date Thu, 11 Sep 2008 09:57:12 GMT
Author: luc
Date: Thu Sep 11 02:57:11 2008
New Revision: 694197

URL: http://svn.apache.org/viewvc?rev=694197&view=rev
Log:
Fixed an infinite loop encountered in some backward integration cases for ODE solvers

Modified:
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
    commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java
    commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java
Thu Sep 11 02:57:11 2008
@@ -91,7 +91,7 @@
             coeffs[i] = f.doubleValue();
         }
 
-        this.step = step;
+        this.step = Math.abs(step);
 
     }
 
@@ -116,7 +116,7 @@
 
         // set up integration control objects
         stepStart = t0;
-        stepSize  = step;
+        stepSize  = forward ? step : -step;
         for (StepHandler handler : stepHandlers) {
             handler.reset();
         }

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java
Thu Sep 11 02:57:11 2008
@@ -107,7 +107,7 @@
             correctorCoeffs[i] = fCorrector.doubleValue();
         }
 
-        this.step = step;
+        this.step = Math.abs(step);
 
     }
 
@@ -132,7 +132,7 @@
 
         // set up integration control objects
         stepStart = t0;
-        stepSize  = step;
+        stepSize  = forward ? step : -step;
         for (StepHandler handler : stepHandlers) {
             handler.reset();
         }

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
Thu Sep 11 02:57:11 2008
@@ -71,8 +71,8 @@
 
     super(name);
 
-    this.minStep     = minStep;
-    this.maxStep     = maxStep;
+    this.minStep     = Math.abs(minStep);
+    this.maxStep     = Math.abs(maxStep);
     this.initialStep = -1.0;
 
     this.scalAbsoluteTolerance = scalAbsoluteTolerance;

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
Thu Sep 11 02:57:11 2008
@@ -73,7 +73,7 @@
     this.a          = a;
     this.b          = b;
     this.prototype  = prototype;
-    this.step       = step;
+    this.step       = Math.abs(step);
   }
 
   /** {@inheritDoc} */
@@ -109,7 +109,7 @@
 
     // set up integration control objects
     stepStart = t0;
-    stepSize  = step;
+    stepSize  = forward ? step : -step;
     for (StepHandler handler : stepHandlers) {
         handler.reset();
     }
@@ -180,7 +180,7 @@
       }
 
       // make sure step size is set to default before next step
-      stepSize = step;
+      stepSize = forward ? step : -step;
 
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/branches/MATH_2_0/src/site/xdoc/changes.xml Thu Sep 11 02:57:11 2008
@@ -39,6 +39,9 @@
   </properties>
   <body>
     <release version="2.0" date="TBD" description="TBD">
+      <action dev="luc" type="fix" due-to="Pascal Parraud">
+        Fixed an infinite loop encountered in some backward integration cases for ODE solvers.
+      </action>
       <action dev="luc" type="add" issue="MATH-222" due-to="Ted Dunning">
         Added beta distribution.
       </action>

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -198,7 +198,25 @@
     assertEquals(0, handler.getMaximalTimeError(), 1.0e-14);
 
   }
-  
+
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
+
+      FirstOrderIntegrator integ = new AdamsBashforthIntegrator(5, step);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 8.0e-11);
+      assertTrue(handler.getMaximalValueError() < 8.0e-11);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("Adams-Bashforth", integ.getName());
+  }
+
   public static Test suite() {
     return new TestSuite(AdamsBashforthIntegratorTest.class);
   }

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -209,6 +209,24 @@
 
     }
 
+    public void testBackward()
+        throws DerivativeException, IntegratorException {
+
+        TestProblem5 pb = new TestProblem5();
+        double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
+
+        FirstOrderIntegrator integ = new AdamsMoultonIntegrator(5, step);
+        TestProblemHandler handler = new TestProblemHandler(pb, integ);
+        integ.addStepHandler(handler);
+        integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                        pb.getFinalTime(), new double[pb.getDimension()]);
+
+        assertTrue(handler.getLastError() < 5.0e-10);
+        assertTrue(handler.getMaximalValueError() < 7.0e-10);
+        assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+        assertEquals("Adams-Moulton", integ.getName());
+    }
+
     public static Test suite() {
         return new TestSuite(AdamsMoultonIntegratorTest.class);
     }

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -145,6 +145,24 @@
 
   }
 
+  public void testBackward()
+    throws DerivativeException, IntegratorException {
+
+    TestProblem5 pb = new TestProblem5();
+    double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
+
+    FirstOrderIntegrator integ = new ClassicalRungeKuttaIntegrator(step);
+    TestProblemHandler handler = new TestProblemHandler(pb, integ);
+    integ.addStepHandler(handler);
+    integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                    pb.getFinalTime(), new double[pb.getDimension()]);
+
+    assertTrue(handler.getLastError() < 5.0e-10);
+    assertTrue(handler.getMaximalValueError() < 7.0e-10);
+    assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+    assertEquals("classical Runge-Kutta", integ.getName());
+  }
+
   public void testKepler()
     throws DerivativeException, IntegratorException {
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -101,6 +101,29 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double minStep = 0;
+      double maxStep = pb.getFinalTime() - pb.getInitialTime();
+      double scalAbsoluteTolerance = 1.0e-8;
+      double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+      FirstOrderIntegrator integ = new DormandPrince54Integrator(minStep, maxStep,
+                                                                 scalAbsoluteTolerance,
+                                                                 scalRelativeTolerance);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 2.0e-7);
+      assertTrue(handler.getMaximalValueError() < 2.0e-7);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("Dormand-Prince 5(4)", integ.getName());
+  }
+
   private static class DP54SmallLastHandler implements StepHandler {
 
     private static final long serialVersionUID = -8168590945325629799L;

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -125,6 +125,29 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double minStep = 0;
+      double maxStep = pb.getFinalTime() - pb.getInitialTime();
+      double scalAbsoluteTolerance = 1.0e-8;
+      double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+      FirstOrderIntegrator integ = new DormandPrince853Integrator(minStep, maxStep,
+                                                                  scalAbsoluteTolerance,
+                                                                  scalRelativeTolerance);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 8.0e-8);
+      assertTrue(handler.getMaximalValueError() < 2.0e-7);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("Dormand-Prince 8 (5, 3)", integ.getName());
+  }
+
   public void testEvents()
     throws DerivativeException, IntegratorException {
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -127,6 +127,24 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
+
+      FirstOrderIntegrator integ = new EulerIntegrator(step);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 0.45);
+      assertTrue(handler.getMaximalValueError() < 0.45);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("Euler", integ.getName());
+  }
+
   public void testStepSize()
     throws DerivativeException, IntegratorException {
       final double step = 1.23456;

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -125,6 +125,24 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
+
+      FirstOrderIntegrator integ = new GillIntegrator(step);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 5.0e-10);
+      assertTrue(handler.getMaximalValueError() < 7.0e-10);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("Gill", integ.getName());
+  }
+
   public void testKepler()
     throws DerivativeException, IntegratorException {
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -90,6 +90,29 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double minStep = 0;
+      double maxStep = pb.getFinalTime() - pb.getInitialTime();
+      double scalAbsoluteTolerance = 1.0e-8;
+      double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+      FirstOrderIntegrator integ = new GraggBulirschStoerIntegrator(minStep, maxStep,
+                                                                    scalAbsoluteTolerance,
+                                                                    scalRelativeTolerance);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 9.0e-10);
+      assertTrue(handler.getMaximalValueError() < 9.0e-10);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("Gragg-Bulirsch-Stoer", integ.getName());
+  }
+
   public void testIncreasingTolerance()
     throws DerivativeException, IntegratorException {
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -138,6 +138,29 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double minStep = 0;
+      double maxStep = pb.getFinalTime() - pb.getInitialTime();
+      double scalAbsoluteTolerance = 1.0e-8;
+      double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+      FirstOrderIntegrator integ = new HighamHall54Integrator(minStep, maxStep,
+                                                              scalAbsoluteTolerance,
+                                                              scalRelativeTolerance);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 5.0e-7);
+      assertTrue(handler.getMaximalValueError() < 5.0e-7);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("Higham-Hall 5(4)", integ.getName());
+  }
+
   public void testEvents()
     throws DerivativeException, IntegratorException {
 

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -127,6 +127,24 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
+
+      FirstOrderIntegrator integ = new MidpointIntegrator(step);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 6.0e-4);
+      assertTrue(handler.getMaximalValueError() < 6.0e-4);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("midpoint", integ.getName());
+  }
+
   public void testStepSize()
     throws DerivativeException, IntegratorException {
       final double step = 1.23456;

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java?rev=694197&r1=694196&r2=694197&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java
Thu Sep 11 02:57:11 2008
@@ -125,6 +125,24 @@
 
   }
 
+  public void testBackward()
+      throws DerivativeException, IntegratorException {
+
+      TestProblem5 pb = new TestProblem5();
+      double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
+
+      FirstOrderIntegrator integ = new ThreeEighthesIntegrator(step);
+      TestProblemHandler handler = new TestProblemHandler(pb, integ);
+      integ.addStepHandler(handler);
+      integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                      pb.getFinalTime(), new double[pb.getDimension()]);
+
+      assertTrue(handler.getLastError() < 5.0e-10);
+      assertTrue(handler.getMaximalValueError() < 7.0e-10);
+      assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+      assertEquals("3/8", integ.getName());
+  }
+
   public void testKepler()
     throws DerivativeException, IntegratorException {
 



Mime
View raw message