double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
double absTolerance = FastMath.pow(10.0, i);
double relTolerance = absTolerance;
FirstOrderIntegrator integ =
new GraggBulirschStoerIntegrator(minStep, maxStep,
absTolerance, relTolerance);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
integ.integrate(pb,
pb.getInitialTime(), pb.getInitialState(),
pb.getFinalTime(), new double[pb.getDimension()]);
// the coefficients are only valid for this test
// and have been obtained from trial and error
// there is no general relation between local and global errors
double ratio = handler.getMaximalValueError() / absTolerance;
Assert.assertTrue(ratio < 2.4);
Assert.assertTrue(ratio > 0.02);
Assert.assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
int calls = pb.getCalls();
Assert.assertEquals(integ.getEvaluations(), calls);
Assert.assertTrue(calls <= previousCalls);
previousCalls = calls;
}