You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2011/01/20 21:55:01 UTC
svn commit: r1061507 [2/2] - in /commons/proper/math/branches/MATH_2_X/src:
main/java/org/apache/commons/math/ode/
main/java/org/apache/commons/math/ode/events/
main/java/org/apache/commons/math/ode/nonstiff/
main/java/org/apache/commons/math/ode/sampl...
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -146,9 +146,9 @@ public class AdamsBashforthIntegratorTes
integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
pb.getFinalTime(), new double[pb.getDimension()]);
if (nSteps < 4) {
- assertTrue(integ.getEvaluations() > 160);
+ assertTrue(integ.getEvaluations() > 150);
} else {
- assertTrue(integ.getEvaluations() < 80);
+ assertTrue(integ.getEvaluations() < 70);
}
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -134,7 +134,8 @@ public class ClassicalRungeKuttaIntegrat
TestProblemAbstract[] problems = TestProblemFactory.getProblems();
for (int k = 0; k < problems.length; ++k) {
- double previousError = Double.NaN;
+ double previousValueError = Double.NaN;
+ double previousTimeError = Double.NaN;
for (int i = 4; i < 10; ++i) {
TestProblemAbstract pb = problems[k].copy();
@@ -157,10 +158,16 @@ public class ClassicalRungeKuttaIntegrat
double error = handler.getMaximalValueError();
if (i > 4) {
- assertTrue(error < FastMath.abs(previousError));
+ assertTrue(error < FastMath.abs(previousValueError));
}
- previousError = error;
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+ previousValueError = error;
+
+ double timeError = handler.getMaximalTimeError();
+ if (i > 4) {
+ assertTrue(timeError <= FastMath.abs(previousTimeError));
+ }
+ previousTimeError = timeError;
+
integ.clearEventHandlers();
assertEquals(0, integ.getEventHandlers().size());
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -64,8 +64,8 @@ public class ClassicalRungeKuttaStepInte
oos.writeObject(handler);
}
- assertTrue(bos.size () > 700000);
- assertTrue(bos.size () < 701000);
+ assertTrue(bos.size () > 753000);
+ assertTrue(bos.size () < 754000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -217,9 +217,10 @@ public class DormandPrince54IntegratorTe
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
EventHandler[] functions = pb.getEventsHandlers();
+ double convergence = 1.0e-8 * maxStep;
for (int l = 0; l < functions.length; ++l) {
integ.addEventHandler(functions[l],
- Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
+ Double.POSITIVE_INFINITY, convergence, 1000);
}
assertEquals(functions.length, integ.getEventHandlers().size());
integ.integrate(pb,
@@ -227,8 +228,8 @@ public class DormandPrince54IntegratorTe
pb.getFinalTime(), new double[pb.getDimension()]);
assertTrue(handler.getMaximalValueError() < 5.0e-6);
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
- assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+ assertEquals(0, handler.getMaximalTimeError(), convergence);
+ assertEquals(12.0, handler.getLastTime(), convergence);
integ.clearEventHandlers();
assertEquals(0, integ.getEventHandlers().size());
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -77,8 +77,8 @@ public class DormandPrince54StepInterpol
oos.writeObject(handler);
}
- assertTrue(bos.size () > 119500);
- assertTrue(bos.size () < 120500);
+ assertTrue(bos.size () > 126000);
+ assertTrue(bos.size () < 127000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -226,9 +226,10 @@ public class DormandPrince853IntegratorT
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
EventHandler[] functions = pb.getEventsHandlers();
+ double convergence = 1.0e-8 * maxStep;
for (int l = 0; l < functions.length; ++l) {
integ.addEventHandler(functions[l],
- Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
+ Double.POSITIVE_INFINITY, convergence, 1000);
}
assertEquals(functions.length, integ.getEventHandlers().size());
integ.integrate(pb,
@@ -236,8 +237,8 @@ public class DormandPrince853IntegratorT
pb.getFinalTime(), new double[pb.getDimension()]);
assertTrue(handler.getMaximalValueError() < 5.0e-8);
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
- assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+ assertEquals(0, handler.getMaximalTimeError(), convergence);
+ assertEquals(12.0, handler.getLastTime(), convergence);
integ.clearEventHandlers();
assertEquals(0, integ.getEventHandlers().size());
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -77,8 +77,8 @@ public class DormandPrince853StepInterpo
oos.writeObject(handler);
}
- assertTrue(bos.size () > 86000);
- assertTrue(bos.size () < 87000);
+ assertTrue(bos.size () > 88000);
+ assertTrue(bos.size () < 89000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -60,12 +60,12 @@ public class EulerIntegratorTest
TestProblemAbstract[] problems = TestProblemFactory.getProblems();
for (int k = 0; k < problems.length; ++k) {
- double previousError = Double.NaN;
- for (int i = 4; i < 10; ++i) {
+ double previousValueError = Double.NaN;
+ double previousTimeError = Double.NaN;
+ for (int i = 4; i < 8; ++i) {
TestProblemAbstract pb = problems[k].copy();
- double step = (pb.getFinalTime() - pb.getInitialTime())
- * FastMath.pow(2.0, -i);
+ double step = (pb.getFinalTime() - pb.getInitialTime()) * FastMath.pow(2.0, -i);
FirstOrderIntegrator integ = new EulerIntegrator(step);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
@@ -81,12 +81,17 @@ public class EulerIntegratorTest
assertEquals(pb.getFinalTime(), stopTime, 1.0e-10);
}
- double error = handler.getMaximalValueError();
+ double valueError = handler.getMaximalValueError();
if (i > 4) {
- assertTrue(error < FastMath.abs(previousError));
+ assertTrue(valueError < FastMath.abs(previousValueError));
}
- previousError = error;
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+ previousValueError = valueError;
+
+ double timeError = handler.getMaximalTimeError();
+ if (i > 4) {
+ assertTrue(timeError <= FastMath.abs(previousTimeError));
+ }
+ previousTimeError = timeError;
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -61,12 +61,12 @@ public class GillIntegratorTest
TestProblemAbstract[] problems = TestProblemFactory.getProblems();
for (int k = 0; k < problems.length; ++k) {
- double previousError = Double.NaN;
+ double previousValueError = Double.NaN;
+ double previousTimeError = Double.NaN;
for (int i = 5; i < 10; ++i) {
TestProblemAbstract pb = problems[k].copy();
- double step = (pb.getFinalTime() - pb.getInitialTime())
- * FastMath.pow(2.0, -i);
+ double step = (pb.getFinalTime() - pb.getInitialTime()) * FastMath.pow(2.0, -i);
FirstOrderIntegrator integ = new GillIntegrator(step);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
@@ -82,12 +82,17 @@ public class GillIntegratorTest
assertEquals(pb.getFinalTime(), stopTime, 1.0e-10);
}
- double error = handler.getMaximalValueError();
+ double valueError = handler.getMaximalValueError();
if (i > 5) {
- assertTrue(error < FastMath.abs(previousError));
+ assertTrue(valueError < FastMath.abs(previousValueError));
}
- previousError = error;
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+ previousValueError = valueError;
+
+ double timeError = handler.getMaximalTimeError();
+ if (i > 5) {
+ assertTrue(timeError <= FastMath.abs(previousTimeError));
+ }
+ previousTimeError = timeError;
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -65,8 +65,8 @@ public class GillStepInterpolatorTest {
oos.writeObject(handler);
}
- assertTrue(bos.size () > 700000);
- assertTrue(bos.size () < 701000);
+ assertTrue(bos.size () > 753000);
+ assertTrue(bos.size () < 754000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -113,8 +113,8 @@ public class GraggBulirschStoerIntegrato
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);
+ assertTrue(handler.getLastError() < 7.5e-9);
+ assertTrue(handler.getMaximalValueError() < 8.1e-9);
assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
assertEquals("Gragg-Bulirsch-Stoer", integ.getName());
}
@@ -210,9 +210,9 @@ public class GraggBulirschStoerIntegrato
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
EventHandler[] functions = pb.getEventsHandlers();
+ double convergence = 1.0e-8 * maxStep;
for (int l = 0; l < functions.length; ++l) {
- integ.addEventHandler(functions[l],
- Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
+ integ.addEventHandler(functions[l], Double.POSITIVE_INFINITY, convergence, 1000);
}
assertEquals(functions.length, integ.getEventHandlers().size());
integ.integrate(pb,
@@ -220,8 +220,8 @@ public class GraggBulirschStoerIntegrato
pb.getFinalTime(), new double[pb.getDimension()]);
assertTrue(handler.getMaximalValueError() < 5.0e-8);
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
- assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+ assertEquals(0, handler.getMaximalTimeError(), convergence);
+ assertEquals(12.0, handler.getLastTime(), convergence);
integ.clearEventHandlers();
assertEquals(0, integ.getEventHandlers().size());
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -79,8 +79,8 @@ public class GraggBulirschStoerStepInter
oos.writeObject(handler);
}
- assertTrue(bos.size () > 33000);
- assertTrue(bos.size () < 34000);
+ assertTrue(bos.size () > 34000);
+ assertTrue(bos.size () < 35000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -32,8 +32,6 @@ import org.apache.commons.math.ode.TestP
import org.apache.commons.math.ode.TestProblemHandler;
import org.apache.commons.math.ode.events.EventException;
import org.apache.commons.math.ode.events.EventHandler;
-import org.apache.commons.math.ode.sampling.StepHandler;
-import org.apache.commons.math.ode.sampling.StepInterpolator;
import org.apache.commons.math.util.FastMath;
public class HighamHall54IntegratorTest
@@ -176,9 +174,10 @@ public class HighamHall54IntegratorTest
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
EventHandler[] functions = pb.getEventsHandlers();
+ double convergence = 1.0e-8 * maxStep;
for (int l = 0; l < functions.length; ++l) {
integ.addEventHandler(functions[l],
- Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
+ Double.POSITIVE_INFINITY, convergence, 1000);
}
assertEquals(functions.length, integ.getEventHandlers().size());
integ.integrate(pb,
@@ -186,8 +185,8 @@ public class HighamHall54IntegratorTest
pb.getFinalTime(), new double[pb.getDimension()]);
assertTrue(handler.getMaximalValueError() < 1.0e-7);
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
- assertEquals(12.0, handler.getLastTime(), 1.0e-8 * maxStep);
+ assertEquals(0, handler.getMaximalTimeError(), convergence);
+ assertEquals(12.0, handler.getLastTime(), convergence);
integ.clearEventHandlers();
assertEquals(0, integ.getEventHandlers().size());
@@ -344,46 +343,13 @@ public class HighamHall54IntegratorTest
FirstOrderIntegrator integ = new HighamHall54Integrator(minStep, maxStep,
vecAbsoluteTolerance,
vecRelativeTolerance);
- integ.addStepHandler(new KeplerHandler(pb));
+ TestProblemHandler handler = new TestProblemHandler(pb, integ);
+ integ.addStepHandler(handler);
integ.integrate(pb,
pb.getInitialTime(), pb.getInitialState(),
pb.getFinalTime(), new double[pb.getDimension()]);
+ assertEquals(0.0, handler.getMaximalValueError(), 1.5e-4);
assertEquals("Higham-Hall 5(4)", integ.getName());
}
- private static class KeplerHandler implements StepHandler {
- public KeplerHandler(TestProblem3 pb) {
- this.pb = pb;
- nbSteps = 0;
- maxError = 0;
- }
- public boolean requiresDenseOutput() {
- return false;
- }
- public void reset() {
- nbSteps = 0;
- maxError = 0;
- }
- public void handleStep(StepInterpolator interpolator,
- boolean isLast) throws MathUserException {
-
- ++nbSteps;
- double[] interpolatedY = interpolator.getInterpolatedState();
- double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
- double dx = interpolatedY[0] - theoreticalY[0];
- double dy = interpolatedY[1] - theoreticalY[1];
- double error = dx * dx + dy * dy;
- if (error > maxError) {
- maxError = error;
- }
- if (isLast) {
- assertTrue(maxError < 4.2e-11);
- assertTrue(nbSteps < 670);
- }
- }
- private TestProblem3 pb;
- private int nbSteps;
- private double maxError;
- }
-
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -77,8 +77,8 @@ public class HighamHall54StepInterpolato
oos.writeObject(handler);
}
- assertTrue(bos.size () > 158000);
- assertTrue(bos.size () < 159000);
+ assertTrue(bos.size () > 167000);
+ assertTrue(bos.size () < 168000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -60,12 +60,12 @@ public class MidpointIntegratorTest
TestProblemAbstract[] problems = TestProblemFactory.getProblems();
for (int k = 0; k < problems.length; ++k) {
- double previousError = Double.NaN;
+ double previousValueError = Double.NaN;
+ double previousTimeError = Double.NaN;
for (int i = 4; i < 10; ++i) {
TestProblemAbstract pb = problems[k].copy();
- double step = (pb.getFinalTime() - pb.getInitialTime())
- * FastMath.pow(2.0, -i);
+ double step = (pb.getFinalTime() - pb.getInitialTime()) * FastMath.pow(2.0, -i);
FirstOrderIntegrator integ = new MidpointIntegrator(step);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
@@ -81,12 +81,17 @@ public class MidpointIntegratorTest
assertEquals(pb.getFinalTime(), stopTime, 1.0e-10);
}
- double error = handler.getMaximalValueError();
+ double valueError = handler.getMaximalValueError();
if (i > 4) {
- assertTrue(error < FastMath.abs(previousError));
+ assertTrue(valueError < FastMath.abs(previousValueError));
}
- previousError = error;
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+ previousValueError = valueError;
+
+ double timeError = handler.getMaximalTimeError();
+ if (i > 4) {
+ assertTrue(timeError <= FastMath.abs(previousTimeError));
+ }
+ previousTimeError = timeError;
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -65,8 +65,8 @@ public class MidpointStepInterpolatorTes
oos.writeObject(handler);
}
- assertTrue(bos.size () > 98000);
- assertTrue(bos.size () < 99000);
+ assertTrue(bos.size () > 114000);
+ assertTrue(bos.size () < 115000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java Thu Jan 20 20:55:00 2011
@@ -61,12 +61,12 @@ public class ThreeEighthesIntegratorTest
TestProblemAbstract[] problems = TestProblemFactory.getProblems();
for (int k = 0; k < problems.length; ++k) {
- double previousError = Double.NaN;
+ double previousValueError = Double.NaN;
+ double previousTimeError = Double.NaN;
for (int i = 4; i < 10; ++i) {
TestProblemAbstract pb = problems[k].copy();
- double step = (pb.getFinalTime() - pb.getInitialTime())
- * FastMath.pow(2.0, -i);
+ double step = (pb.getFinalTime() - pb.getInitialTime()) * FastMath.pow(2.0, -i);
FirstOrderIntegrator integ = new ThreeEighthesIntegrator(step);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
@@ -84,10 +84,15 @@ public class ThreeEighthesIntegratorTest
double error = handler.getMaximalValueError();
if (i > 4) {
- assertTrue(error < FastMath.abs(previousError));
+ assertTrue(error < FastMath.abs(previousValueError));
}
- previousError = error;
- assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
+ previousValueError = error;
+
+ double timeError = handler.getMaximalTimeError();
+ if (i > 4) {
+ assertTrue(timeError <= FastMath.abs(previousTimeError));
+ }
+ previousTimeError = timeError;
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -64,8 +64,8 @@ public class ThreeEighthesStepInterpolat
oos.writeObject(handler);
}
- assertTrue(bos.size () > 700000);
- assertTrue(bos.size () < 701000);
+ assertTrue(bos.size () > 753000);
+ assertTrue(bos.size () < 754000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -91,8 +91,8 @@ public class DummyStepInterpolatorTest {
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(interpolator);
- assertTrue(bos.size () > 150);
- assertTrue(bos.size () < 250);
+ assertTrue(bos.size () > 200);
+ assertTrue(bos.size () < 300);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java?rev=1061507&r1=1061506&r2=1061507&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java Thu Jan 20 20:55:00 2011
@@ -41,7 +41,7 @@ public class NordsieckStepInterpolatorTe
throws MathUserException, IntegratorException {
TestProblem3 pb = new TestProblem3();
AdamsBashforthIntegrator integ = new AdamsBashforthIntegrator(4, 0.0, 1.0, 1.0e-10, 1.0e-10);
- StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 7e-10);
+ StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 5e-9);
}
@Test
@@ -62,8 +62,8 @@ public class NordsieckStepInterpolatorTe
oos.writeObject(handler);
}
- assertTrue(bos.size () > 20000);
- assertTrue(bos.size () < 25000);
+ assertTrue(bos.size () > 25500);
+ assertTrue(bos.size () < 26500);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);