Commons Math
  1. Commons Math
  2. MATH-358

ODE integrator goes past specified end of integration range

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Labels:
      None
    • Environment:

      Linux

      Description

      End of integration range in ODE solving is handled as an event.
      In some cases, numerical accuracy in events detection leads to error in events location.
      The following test case shows the end event is not handled properly and an integration that should cover a 60s range in fact covers a 160s range, more than twice the specified range.

        public void testMissedEvent() throws IntegratorException, DerivativeException {
                final double t0 = 1878250320.0000029;
                final double t =  1878250379.9999986;
                FirstOrderDifferentialEquations ode = new FirstOrderDifferentialEquations() {
                  
                  public int getDimension() {
                      return 1;
                  }
                  
                  public void computeDerivatives(double t, double[] y, double[] yDot)
                      throws DerivativeException {
                      yDot[0] = y[0] * 1.0e-6;
                  }
              };
      
              DormandPrince853Integrator integrator = new DormandPrince853Integrator(0.0, 100.0,
                                                                                     1.0e-10, 1.0e-10);
      
              double[] y = { 1.0 };
              integrator.setInitialStepSize(60.0);
              double finalT = integrator.integrate(ode, t0, y, t, y);
              Assert.assertEquals(t, finalT, 1.0e-6);
          }
      
      

        Activity

        Hide
        Luc Maisonobe added a comment -

        fixed in subversion repository as of r927202

        Show
        Luc Maisonobe added a comment - fixed in subversion repository as of r927202

          People

          • Assignee:
            Luc Maisonobe
            Reporter:
            Luc Maisonobe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development