protected <T extends RealFieldElement<T>> void doNonFieldInterpolatorConsistency( final Field<T> field, double epsilonSin, double epsilonCos, double epsilonSinDot, double epsilonCosDot) { FirstOrderFieldDifferentialEquations<T> eqn = new SinCos<T>(field); RungeKuttaFieldStepInterpolator<T> fieldInterpolator = setUpInterpolator(field, eqn, 0.0, new double[] {0.0, 1.0}, 0.125); RungeKuttaStepInterpolator regularInterpolator = convertInterpolator(fieldInterpolator, eqn); int n = 100; double maxErrorSin = 0; double maxErrorCos = 0; double maxErrorSinDot = 0; double maxErrorCosDot = 0; for (int i = 0; i <= n; ++i) { T t = fieldInterpolator .getPreviousState() .getTime() .multiply(n - i) .add(fieldInterpolator.getCurrentState().getTime().multiply(i)) .divide(n); FieldODEStateAndDerivative<T> state = fieldInterpolator.getInterpolatedState(t); T[] fieldY = state.getState(); T[] fieldYDot = state.getDerivative(); regularInterpolator.setInterpolatedTime(t.getReal()); double[] regularY = regularInterpolator.getInterpolatedState(); double[] regularYDot = regularInterpolator.getInterpolatedDerivatives(); maxErrorSin = FastMath.max(maxErrorSin, fieldY[0].subtract(regularY[0]).abs().getReal()); maxErrorCos = FastMath.max(maxErrorCos, fieldY[1].subtract(regularY[1]).abs().getReal()); maxErrorSinDot = FastMath.max(maxErrorSinDot, fieldYDot[0].subtract(regularYDot[0]).abs().getReal()); maxErrorCosDot = FastMath.max(maxErrorCosDot, fieldYDot[1].subtract(regularYDot[1]).abs().getReal()); } Assert.assertEquals(0.0, maxErrorSin, epsilonSin); Assert.assertEquals(0.0, maxErrorCos, epsilonCos); Assert.assertEquals(0.0, maxErrorSinDot, epsilonSinDot); Assert.assertEquals(0.0, maxErrorCosDot, epsilonCosDot); }