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: Ken Marek
Subject: [Octave-bug-tracker] [bug #63063] ode{23, 45} options "Events" and "OutputFcn" do not perform correctly.
Date: Mon, 19 Sep 2022 17:53:46 -0400 (EDT)

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

Here is what I believe to be the overall fix to this bug
<bug_fix_63063_total-20220919.patch>

This incorporates the changes in comment #5, as well as additional fixes in
integrate_adaptive.m to process Events and OutputFcn at approximately the same
time. There is also an additional semicolon fix in ode_event_handler.m.

I am also attaching updated test scripts and results:<bug63063_data_v02.zip>.
These update the ones given by Nicholas in comment #7 in a few useful ways, in
addition to incorporating the rest of my fixes. In particular:
* testscript.m now tries four tests, with four parts each.
  * Part 1: outputs as variables, fixed time specified
  * Part 2: outputs as struct, fixed time specified
  * Part 3: outputs as variables, start/stop time specified
  * Part 4: outputs as struct, start/stop time specified
  * Specified times for parts 1 & 2 are now [0, 1.05, 2, 2.5] to show whether
the solver outputs the specified times or not.
* testFuncOut.m now allows multiple points to be input per step, as it turns
out Matlab does this in some cases. A second point is output as the same step
number, but iteration 2.
* testEvent.m now has three events, at y = {0.1, 1.1, 1.5}. The last event is
still terminal. This lets us see what happens when two events occur in a
single time step.

Diary files are included for Matlab, Octave original (bug), and Octave fixed.
You can see that the Octave original shows all the bugs I mentioned before.
Octave fixed mostly agrees with Matlab. In particular, the OutputFcn is called
even when a terminal Event is found on that step. Duplicate calls of OutputFcn
are removed (vs. original Octave output). Multiple Events are processed in a
single step, like in Matlab. This patch corrects all the things I set out to
fix at present, so that I can work on adding Refine capability once this is
accepted.

There are, however, a few more issues, which should perhaps be added as their
own bugs.
* As I mentioned in a previous comment, Matlab behavior for terminal Events in
the first step is somewhat different than what they describe in their
documentation, and also different from current Octave implementation. I have
not attempted to address that issue here.
* Matlab behaves somewhat differently from Octave (the new, fixed version
submitted here) when outputting a struct from ode45 (etc.). In particular, see
the diary files for Test 3/Part 2. When output time values are specified,
Matlab calls the OutputFcn at those specified times (including sending
multiple values at once if they fall on the same solution step), even though
it ignores the specified times for the x and y values in the struct. Octave
also ignores the specified times for x and y in the struct, but it also
ignores them when calling the OutputFcn, sending those same x and y values as
found in the struct. The fix for this issue is a bit more structural than the
others I have submitted for this bug, and so I am leaving it unaddressed for
now. I think this is less serious than the other issues I addressed, since (1)
an OutputFcn can be written to accept multiple points at once, and then
perform about the same with Matlab or Octave; and (2) the user can force
Matlab and Octave to output at the specified times by taking the variables as
an output instead of a struct, which I think is a fairly easy workaround.



(file #53722, file #53723)

    _______________________________________________________

Additional Item Attachment:

File name: bug_fix_63063_total-20220919.patch Size:11 KB
   
<https://file.savannah.gnu.org/file/bug_fix_63063_total-20220919.patch?file_id=53722>

File name: bug63063_data_v02.zip          Size:4 KB
    <https://file.savannah.gnu.org/file/bug63063_data_v02.zip?file_id=53723>



    _______________________________________________________

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]