throws DimensionMismatchException, NumberIsTooSmallException,
MaxCountExceededException, NoBracketingException {
int previousCalls = Integer.MAX_VALUE;
for (int i = -12; i < -2; ++i) {
TestProblem1 pb = new TestProblem1();
double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
double scalAbsoluteTolerance = FastMath.pow(10.0, i);
double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
EmbeddedRungeKuttaIntegrator integ =
new DormandPrince54Integrator(minStep, maxStep,
scalAbsoluteTolerance, scalRelativeTolerance);
TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.setSafety(0.8);
integ.setMaxGrowth(5.0);
integ.setMinReduction(0.3);
integ.addStepHandler(handler);
integ.integrate(pb,
pb.getInitialTime(), pb.getInitialState(),
pb.getFinalTime(), new double[pb.getDimension()]);
Assert.assertEquals(0.8, integ.getSafety(), 1.0e-12);
Assert.assertEquals(5.0, integ.getMaxGrowth(), 1.0e-12);
Assert.assertEquals(0.3, integ.getMinReduction(), 1.0e-12);
// the 0.7 factor is only valid for this test
// and has been obtained from trial and error
// there is no general relation between local and global errors
Assert.assertTrue(handler.getMaximalValueError() < (0.7 * scalAbsoluteTolerance));
Assert.assertEquals(0, handler.getMaximalTimeError(), 1.0e-12);
int calls = pb.getCalls();
Assert.assertEquals(integ.getEvaluations(), calls);
Assert.assertTrue(calls <= previousCalls);
previousCalls = calls;
}