bugGNU Octave - Bugs: bug #49890, error if event function stops ode45

 
 

bug #49890: error if event function stops ode45

Submitter:  None
Submitted:  Tue 20 Dec 2016 04:50:30 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  cdf
Originator Name:  BP Minaker Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 26 Dec 2016 04:33:12 PM UTC, comment #5: 

I fixed the issued with ode23, ode45 on the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/2b2ac017c901).

Rik <rik5>
Group administrator
Fri 23 Dec 2016 01:23:21 PM UTC, comment #4: 

I was hoping the submitter would provide an example so hadn't commented on this bug earlier. The error message reported by the user can be reproduced by changing the ode45 call in the sample below to

[t,y,te,ye] = ode45 (@(t,y) 2, [0, 2], 1, opts)

It is valid in matlab to have less than 5 return arguments when events are included. A fix for this and several other odeIJ bugs
is in my repository here

https://bitbucket.org/wgreene71/octave


Bill Greene <billgreene>
Fri 23 Dec 2016 06:03:25 AM UTC, comment #3: 

Without an example from the original reporter, we can close this bug.  It works for me with a trivial event function


function [value, isterminal, direction] = evfcn (t, y)

  isterminal = 1;
  direction = 0;

  if (t < 1)
    value = 1;
  else
    value = 0;
  endif

end


and the call


opts = odeset ('Events', @evfcn);
[t,y,te,ye,ie] = ode45 (@(t,y) 2, [0, 2], 1, opts)
warning: Solver was stopped by a call of 'break' in the main iteration loop at time t = 1.146792 before the endpoint at tend = 2.000000 was reached.  This may happen because the @odeplot function returned 'true' or the @event function returned 'true'.
warning: called from
    integrate_adaptive at line 319 column 7
    ode45 at line 227 column 12
t =

   0.00000
   0.14679
   0.34679
   0.54679
   0.74679
   0.94679
   1.14679

y =

   1.0000
   1.2936
   1.6936
   2.0936
   2.4936
   2.8936
   3.2936

te =  1.1468
ye =  3.2936
ie =  1



Rik <rik5>
Group administrator
Tue 20 Dec 2016 10:23:26 AM UTC, comment #2: 

... or can you send a minimal example? That would help us debugging it and finally to add a test.

Seb.

Sebastian <sschoeps>
Tue 20 Dec 2016 09:13:28 AM UTC, comment #1: 

Thanks for reporting this.

Do you happen to also know a solution?
I'm cc-ing the odepkg package maintainers as this may also affect solvers in that package.

c.

Carlo de Falco <cdf>
Group Member
Tue 20 Dec 2016 04:50:30 AM UTC, original submission:  

If an event function triggers a stop in ode45, the result is an error: element number 1 undefined in return list
It appears that ode45 fails to return any solution arguments if it is stopped before the end of the solution interval.


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by billgreene (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sschoeps (Posted a comment)
  • -email is unavailable- added by cdf (Posted a comment)
  • -email is unavailable- added by cdf
  • -email is unavailable- added by cdf
  • -email is unavailable- added by cdf
  • -email is unavailable- added by cdf
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-12-26 rik5 StatusWorks For Me Fixed
        Open/ClosedOpen Closed
    2016-12-23 rik5 StatusNone Works For Me
    2016-12-20 cdf Assigned toNone cdf
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code