Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-705

DormandPrince853 integrator leads to revisiting of state events



    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0
    • None
    • None
    • Commons Math trunk, Java 6, Linux


      See the attached ReappearingEventTest.java. It has two unit tests, which use either the DormandPrince853 or the GraggBulirschStoer integrator, on the same ODE problem. It is a problem starting at time 6.0, with 7 variables, and 1 state event. The state event was previously detected at time 6.0, which is why I start there now. I provide and end time of 10.0. Since I start at the state event, I expect to integrate all the way to the end (10.0). For the GraggBulirschStoer this is what happens (see attached ReappearingEventTest.out). For the DormandPrince853Integerator, it detects a state event and stops integration at 6.000000000000002.

      I think the problem becomes clear by looking at the output in ReappearingEventTest.out, in particular these lines:

      computeDerivatives: t=6.0                  y=[2.0                 , 2.0                 , 2.0                 , 4.0                 , 2.0                 , 7.0                 , 15.0                ]
      g                 : t=6.0                  y=[1.9999999999999996  , 1.9999999999999996  , 1.9999999999999996  , 4.0                 , 1.9999999999999996  , 7.0                 , 14.999999999999998  ]
      final result      : t=6.000000000000002    y=[2.0000000000000013  , 2.0000000000000013  , 2.0000000000000013  , 4.000000000000002   , 2.0000000000000013  , 7.000000000000002   , 15.0                ]

      The initial value of the last variable in y, the one that the state event refers to, is 15.0. However, the first time it is given to the g function, the value is 14.999999999999998. This value is less than 15, and more importantly, it is a value from the past (as all functions are increasing), before the state event. This makes that the state event re-appears immediately, and integration stops at 6.000000000000002 because of the detected state event.

      I find it puzzling that for the DormandPrince853Integerator the y array that is given to the first evaluation of the g function, has different values than the y array that is the input to the problem. For GraggBulirschStoer is can be seen that the y arrays have identical values.


        1. ReappearingEventTest.java
          3 kB
          Dennis Hendriks
        2. ReappearingEventTest.out
          20 kB
          Dennis Hendriks



            luc Luc Maisonobe
            dhendriks Dennis Hendriks
            0 Vote for this issue
            1 Start watching this issue