}
}
@Test
public void testStepSizeUnstability() {
UnivariateDifferentiableFunction quintic = new QuinticFunction();
UnivariateDifferentiableFunction goodStep =
new FiniteDifferencesDifferentiator(7, 0.25).differentiate(quintic);
UnivariateDifferentiableFunction badStep =
new FiniteDifferencesDifferentiator(7, 1.0e-6).differentiate(quintic);
double[] maxErrorGood = new double[7];
double[] maxErrorBad = new double[7];
for (double x = -10; x < 10; x += 0.1) {
DerivativeStructure dsX = new DerivativeStructure(1, 6, 0, x);
DerivativeStructure yRef = quintic.value(dsX);
DerivativeStructure yGood = goodStep.value(dsX);
DerivativeStructure yBad = badStep.value(dsX);
for (int order = 0; order <= 6; ++order) {
maxErrorGood[order] = FastMath.max(maxErrorGood[order],
FastMath.abs(yRef.getPartialDerivative(order) -