octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63063] ode{23, 45} options "Events" and "Outp


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #63063] ode{23, 45} options "Events" and "OutputFcn" do not perform correctly.
Date: Mon, 19 Sep 2022 09:44:28 -0400 (EDT)

Follow-up Comment #7, bug #63063 (project octave):

testing on ubuntu, both comment #5 patches push cleanly (don't know if order
mattered, but I did the event handler and then struct fix)

make check returns 


 PASS                            17446
  FAIL                                2
  XFAIL (reported bug)               35
  SKIP (missing feature)              3
  SKIP (run-time condition)          27


the two failures appear to just be tests due to the orientation change patch.
so those BISTs should be updated:


>>>>> processing /home/nrjank/source/octave/scripts/ode/ode23.m
***** test  # Events option, now stop integration
 warning ("off", "integrate_adaptive:unexpected_termination", "local");
 opt = odeset ("Events", @fevn, "NormControl", "on");
 sol = ode23 (@fpol, [0 10], [2 0], opt);
 assert ([sol.ie, sol.xe, sol.ye],
         [2.0, 2.496110, -0.830550, -2.677589], .5e-1);
!!!!! test failed
horizontal dimensions mismatch (1x2 vs 2x1)
>>>>> processing /home/nrjank/source/octave/scripts/ode/ode23s.m
>>>>> processing /home/nrjank/source/octave/scripts/ode/ode45.m
***** test  # Events option, now stop integration
 warning ("off", "integrate_adaptive:unexpected_termination", "local");
 opt = odeset ("Events", @fevn, "NormControl", "on");
 sol = ode45 (@fpol, [0 10], [2 0], opt);
 assert ([sol.ie, sol.xe, sol.ye],
         [2.0, 2.496110, -0.830550, -2.677589], 6e-1);
!!!!! test failed
horizontal dimensions mismatch (1x2 vs 2x1)



I ran  the comment #0 and comment #1 tests with four test cases in matlab,
patched and unpatched octave.  to be honest I haven't parsed them to verify
corrected behavior, but they are here for inspection. 

I've attached the testscript and the function files used to run this under the
different programs in case they need to be rechecked with any patch revision.

Matlab 2022a:

test 1 (baseline)
odeOpt = 
  struct with fields:

              AbsTol: []
                 BDF: []
              Events: []
         InitialStep: 1
            Jacobian: []
           JConstant: []
            JPattern: []
                Mass: []
        MassSingular: []
            MaxOrder: []
             MaxStep: 1
         NonNegative: []
         NormControl: []
           OutputFcn: []
           OutputSel: []
              Refine: 1
              RelTol: []
               Stats: []
          Vectorized: []
    MStateDependence: []
           MvPattern: []
        InitialSlope: []
t =
         0
    1.0000
    2.0000
    2.5000
y =
         0
    1.0000
    2.0000
    2.5000
structOut = 
  struct with fields:

     solver: 'ode45'
    extdata: [1×1 struct]
          x: [0 1 2 2.5000]
          y: [0 1.0000 2.0000 2.5000]
      stats: [1×1 struct]
      idata: [1×1 struct]
test 2 (event only)
odeOpt = 
  struct with fields:

              AbsTol: []
                 BDF: []
              Events: @testEvent
         InitialStep: 1
            Jacobian: []
           JConstant: []
            JPattern: []
                Mass: []
        MassSingular: []
            MaxOrder: []
             MaxStep: 1
         NonNegative: []
         NormControl: []
           OutputFcn: []
           OutputSel: []
              Refine: 1
              RelTol: []
               Stats: []
          Vectorized: []
    MStateDependence: []
           MvPattern: []
        InitialSlope: []
t =
         0
    1.0000
    1.5000
y =
         0
    1.0000
    1.5000
structOut = 
  struct with fields:

     solver: 'ode45'
    extdata: [1×1 struct]
          x: [0 1 1.5000]
          y: [0 1.0000 1.5000]
         xe: [0.1000 1.5000]
         ye: [0.1000 1.5000]
         ie: [1 2]
      stats: [1×1 struct]
      idata: [1×1 struct]
test 3 (output function only)
odeOpt = 
  struct with fields:

              AbsTol: []
                 BDF: []
              Events: []
         InitialStep: 1
            Jacobian: []
           JConstant: []
            JPattern: []
                Mass: []
        MassSingular: []
            MaxOrder: []
             MaxStep: 1
         NonNegative: []
         NormControl: []
           OutputFcn: @testFuncOut
           OutputSel: []
              Refine: 1
              RelTol: []
               Stats: []
          Vectorized: []
    MStateDependence: []
           MvPattern: []
        InitialSlope: []
Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 2, y = 2
y value is 2, greater than 1.2. Sending STOP signal.
Output function received DONE signal
t =
     0
     1
     2
y =
         0
    1.0000
    2.0000
Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 2, y = 2
y value is 2, greater than 1.2. Sending STOP signal.
Output function received DONE signal
structOut = 
  struct with fields:

     solver: 'ode45'
    extdata: [1×1 struct]
          x: [0 1 2]
          y: [0 1.0000 2.0000]
      stats: [1×1 struct]
      idata: [1×1 struct]
test 4 (event and output function)
odeOpt = 
  struct with fields:

              AbsTol: []
                 BDF: []
              Events: @testEvent
         InitialStep: 1
            Jacobian: []
           JConstant: []
            JPattern: []
                Mass: []
        MassSingular: []
            MaxOrder: []
             MaxStep: 1
         NonNegative: []
         NormControl: []
           OutputFcn: @testFuncOut
           OutputSel: []
              Refine: 1
              RelTol: []
               Stats: []
          Vectorized: []
    MStateDependence: []
           MvPattern: []
        InitialSlope: []
Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 1.5, y = 1.5
y value is 1.5, greater than 1.2. Sending STOP signal.
Output function received DONE signal
t =
         0
    1.0000
    1.5000
y =
         0
    1.0000
    1.5000
Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 1.5, y = 1.5
y value is 1.5, greater than 1.2. Sending STOP signal.
Output function received DONE signal
structOut = 
  struct with fields:

     solver: 'ode45'
    extdata: [1×1 struct]
          x: [0 1 1.5000]
          y: [0 1.0000 1.5000]
         xe: [0.1000 1.5000]
         ye: [0.1000 1.5000]
         ie: [1 2]
      stats: [1×1 struct]
      idata: [1×1 struct]


Octave 8.0.0 with these patches:

test 1 (baseline)
odeOpt =
  scalar structure containing the fields:
    Events = [](0x0)
    InitialStep = 1
    OutputFcn = [](0x0)
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

t =
        0
   1.0000
   2.0000
   2.5000

y =
        0
   1.0000
   2.0000
   2.5000

structOut =
  scalar structure containing the fields:
    x =
            0   1.0000   2.0000   2.5000
    y =
            0   1.0000   2.0000   2.5000
    solver = ode45

test 2 (event only)
odeOpt =
  scalar structure containing the fields:
    Events = @testEvent
    InitialStep = 1
    OutputFcn = [](0x0)
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

evtcntnew = 1
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t = 1.500000 before the endpoint at tend = 2.500000 was reached.  This
may happen because the @odeplot function returned 'true' or the @event
function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 10 column 12

t =
        0
   1.0000
   1.5000

y =
        0
   1.0000
   1.5000

evtcntnew = 1
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t = 1.500000 before the endpoint at tend = 2.500000 was reached.  This
may happen because the @odeplot function returned 'true' or the @event
function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 11 column 15

structOut =
  scalar structure containing the fields:
    x =
            0   1.0000   1.5000
    y =
            0   1.0000   1.5000
    solver = ode45
    xe =
       0.1000   1.5000
    ye =
       0.1000   1.5000
    ie =
       1   2

test 3 (output function only)
odeOpt =
  scalar structure containing the fields:
    Events = [](0x0)
    InitialStep = 1
    OutputFcn = @testFuncOut
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 2, y = 2
y value is 2, greater than 1.2. Sending STOP signal.
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t = 2.000000 before the endpoint at tend = 2.500000 was reached.  This
may happen because the @odeplot function returned 'true' or the @event
function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 16 column 12

Output function received DONE signal
t =
   0
   1
   2

y =
   0
   1
   2

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 2, y = 2
y value is 2, greater than 1.2. Sending STOP signal.
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t = 2.000000 before the endpoint at tend = 2.500000 was reached.  This
may happen because the @odeplot function returned 'true' or the @event
function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 17 column 15

Output function received DONE signal
structOut =
  scalar structure containing the fields:
    x =
       0   1   2
    y =
       0   1   2
    solver = ode45

test 4 (event and output function)
odeOpt =
  scalar structure containing the fields:
    Events = @testEvent
    InitialStep = 1
    OutputFcn = @testFuncOut
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
evtcntnew = 1
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t = 1.500000 before the endpoint at tend = 2.500000 was reached.  This
may happen because the @odeplot function returned 'true' or the @event
function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 22 column 12

Output function received DONE signal
t =
        0
   1.0000
   1.5000

y =
        0
   1.0000
   1.5000

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
evtcntnew = 1
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t = 1.500000 before the endpoint at tend = 2.500000 was reached.  This
may happen because the @odeplot function returned 'true' or the @event
function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 23 column 15

Output function received DONE signal
structOut =
  scalar structure containing the fields:
    x =
            0   1.0000   1.5000
    y =
            0   1.0000   1.5000
    solver = ode45
    xe =
       0.1000   1.5000
    ye =
       0.1000   1.5000
    ie =
       1   2



and for reference, Octave 7.2.0 unpatched:

test 1 (baseline)
odeOpt =
  scalar structure containing the fields:
    Events = [](0x0)
    InitialStep = 1
    OutputFcn = [](0x0)
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

t =
        0
   1.0000
   2.0000
   2.5000

y =
        0
   1.0000
   2.0000
   2.5000

structOut =
  scalar structure containing the fields:
    x =
            0   1.0000   2.0000   2.5000
    y =
            0   1.0000   2.0000   2.5000
    solver = ode45

test 2 (event only)
odeOpt =
  scalar structure containing the fields:
    Events = @testEvent
    InitialStep = 1
    OutputFcn = [](0x0)
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t =
 1.500000 before the endpoint at tend = 2.500000 was reached.  This may happen
because
the @odeplot function returned 'true' or the @event function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 10 column 12

t =
        0
   1.0000
   1.5000

y =
        0
   1.0000
   1.5000

warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t =
 1.500000 before the endpoint at tend = 2.500000 was reached.  This may happen
because
the @odeplot function returned 'true' or the @event function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 11 column 15

structOut =
  scalar structure containing the fields:
    x =
            0   1.0000   1.5000
    y =
            0   1.0000   1.5000
    solver = ode45
    xe =
       0.1000
       1.5000
    ye =
       0.1000
       1.5000
    ie =
       1
       2

test 3 (output function only)
odeOpt =
  scalar structure containing the fields:
    Events = [](0x0)
    InitialStep = 1
    OutputFcn = @testFuncOut
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 2, y = 2
y value is 2, greater than 1.2. Sending STOP signal.
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t =
 2.000000 before the endpoint at tend = 2.500000 was reached.  This may happen
because
the @odeplot function returned 'true' or the @event function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 16 column 12

Output function received DONE signal
t =
   0
   1
   2

y =
   0
   1
   2

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
Step: 2, t = 2, y = 2
y value is 2, greater than 1.2. Sending STOP signal.
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t =
 2.000000 before the endpoint at tend = 2.500000 was reached.  This may happen
because
the @odeplot function returned 'true' or the @event function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 17 column 15

Output function received DONE signal
structOut =
  scalar structure containing the fields:
    x =
       0   1   2
    y =
       0   1   2
    solver = ode45
test 4 (event and output function)
odeOpt =
  scalar structure containing the fields:
    Events = @testEvent
    InitialStep = 1
    OutputFcn = @testFuncOut
    Refine = 1
    MaxStep = 1
    AbsTol = [](0x0)
    BDF = [](0x0)
    InitialSlope = [](0x0)
    JConstant = [](0x0)
    JPattern = [](0x0)
    Jacobian = [](0x0)
    MStateDependence = [](0x0)
    Mass = [](0x0)
    MassSingular = [](0x0)
    MaxOrder = [](0x0)
    MvPattern = [](0x0)
    NonNegative = [](0x0)
    NormControl = [](0x0)
    OutputSel = [](0x0)
    RelTol = [](0x0)
    Stats = [](0x0)
    Vectorized = [](0x0)

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t =
 1.500000 before the endpoint at tend = 2.500000 was reached.  This may happen
because
the @odeplot function returned 'true' or the @event function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 22 column 12
Output function received DONE signal
t =
        0
   1.0000
   1.5000

y =
        0
   1.0000
   1.5000

Step: 0, t = 0, y = 0
Step: 1, t = 1, y = 1
warning: Solver was stopped by a call of 'break' in the main iteration loop at
time t =
 1.500000 before the endpoint at tend = 2.500000 was reached.  This may happen
because
the @odeplot function returned 'true' or the @event function returned 'true'.
warning: called from
    integrate_adaptive at line 327 column 7
    ode45 at line 241 column 12
    testscript at line 23 column 15

Output function received DONE signal
structOut =
  scalar structure containing the fields:
    x =
            0   1.0000   1.5000
    y =
            0   1.0000   1.5000
    solver = ode45
    xe =
       0.1000
       1.5000
    ye =
       0.1000
       1.5000
    ie =
       1
       2


(file #53716)

    _______________________________________________________

Additional Item Attachment:

File name: bug63063testscripts.zip        Size:1 KB
    <https://file.savannah.gnu.org/file/bug63063testscripts.zip?file_id=53716>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63063>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]