public void handleStep(StepInterpolator interpolator, boolean isLast)
        throws DerivativeException {

      ++nbSteps;
      for (int a = 1; a < 100; ++a) {

        double prev = interpolator.getPreviousTime();
        double curr = interpolator.getCurrentTime();
        double interp = ((100 - a) * prev + a * curr) / 100;
        interpolator.setInterpolatedTime(interp);

        double[] interpolatedY = interpolator.getInterpolatedState();
        double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime());
        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 < 2.7e-6);
        assertTrue(nbSteps < 80);
      }
    }
Exemplo n.º 2
0
    public void handleStep(StepInterpolator interpolator, boolean isLast)
        throws DerivativeException {

      ++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);
      }
    }