bugGNU Octave - Bugs: bug #50012, ode23 internal interpolation

 
 

bug #50012: ode23 internal interpolation

Submitter:  Andreas Stahel <sha1>
Submitted:  Tue 10 Jan 2017 09:38:04 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  cdf
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 18 Apr 2017 12:30:56 PM UTC, comment #8: 

Andreas confirmed privately that the "issue" with "ode45" was actually a "feature" :
in short, the chosen algorithm trades accuracy on the derivatives of interpolated values for efficiency and is compatible with matlab, so it does not need to be changed.

I pushed Andreas' fix for ode23 with this changeset: http://hg.savannah.gnu.org/hgweb/octave/rev/e265ae9e7a6c

c.

Carlo de Falco <cdf>
Group Member
Tue 11 Apr 2017 09:15:57 PM UTC, comment #7: 

I was waiting to here about the fix for ode45, but didn't here from Andrea's.
I'll just push the ode23 fix now then ping Andreas again.
c.

Carlo de Falco <cdf>
Group Member
Mon 10 Apr 2017 06:05:14 PM UTC, comment #6: 

@Carlo: I think you were going to turn Andreas' patches from Octconf into a changeset and push them.  Any progress?

Rik <rik5>
Group administrator
Mon 03 Apr 2017 03:24:50 PM UTC, comment #5: 

This is good news.  As long as you're on top of it I'll wait for the changesets to be committed.  Marking the report with "Patch Submitted".

Rik <rik5>
Group administrator
Mon 03 Apr 2017 08:09:30 AM UTC, comment #4: 

Hi,

Andreas managed to solve the problem on his own during OctConf,
The modified versions of ode23 and runge_kutta_interpolate are in attachment.

It seems the bug was due to the fact that the derivatives used in hermite interpolation were being given an incorrect value when invoking runge_kutta_interpolate.

If no one objects I'll turn this files into a changeset and push them tomorrow.

@Andreas, we also discussed a similar (but not identical) change for ode45, do you also have a patch for that?

c.

(file #40241, file #40242)

Carlo de Falco <cdf>
Group Member
Wed 11 Jan 2017 10:23:57 AM UTC, comment #3: 

Hi,

I do not believe this issue is related to the "Refine" bug.

The error seems indeed to be in the interpolation routine. As Carlo mentioned the choice in Matlab is not clear. What is stated in the documentation is:

"... the solutions produced at the specified points are of the same order of accuracy as the solutions computed at each internal step"

Tests show that ode23 is a third order scheme in Matlab (i.e. it uses local extrapolation) so in Octave we set the order of the solver to 3 and that order is used to choose the proper interpolation algorithm. In this case it is a cubic hermite interpolant that exploits the values and the derivatives at t and t+dt. There could be a bug there, I will check...

In the case of ode45, although it is a scheme of order 5 (it uses local extrapolation too), Shampine proposes to use a 4th order interpolation scheme that avoids further function evaluations. I am not sure what method Matlab is choosing in the end.

Jacopo Corno <jcorno>
Tue 10 Jan 2017 05:14:30 PM UTC, comment #2: 

Is this at all related to bug #49408 ("Refine" option not implemented for ode23, ode45)?

Rik <rik5>
Group administrator
Tue 10 Jan 2017 10:39:49 AM UTC, comment #1: 

Hi,

I'm CC-ing Sebastian, Jacopo and Marco
to this ticket as we already had a discussion
about how the "order" of the ODE methods is
treated in the RK solvers.

I don't recll exactly the details but it seems
that ode45 is using local extrapolation while
ode23 isn't (or he other way around) and that,
although inconsistent, this behaviour is compatible
with Matlab. Can someone confirm?

As a result it is not clear to me what "order" should
be used for interpolation and time step selection in
each method ...



Carlo de Falco <cdf>
Group Member
Tue 10 Jan 2017 09:38:04 AM UTC, original submission:  

Recently I ran across a possible problem in the integration/interpolation of the ode23 solver.
Examine the result of the enclosed script.
The problem shows when working with the derivative of a solution and is most likely caused by the interpolation to the values given in tspan.
When I change line 157 in the function integrate_adaptive
order --> order+1  or order --> order-1
the results look smooth.
Thus I suspect a minor problem with the piecewise interpolation of the order used by ode23.

The problems show in version 4.2.0 and the development branch.
The version of ode23 in odepkg does not display the problem.

With best regards

Andreas Stahel

Andreas Stahel <sha1>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #40241:  ode23.m added by cdf (20KiB - application/octet-stream)
file #40242:  runge_kutta_interpolate.m added by cdf (4KiB - application/octet-stream)
file #39422:  Test_ode23.m added by sha1 (838B - application/vnd.wolfram.mathematica.package)
file #39423:  Test_ode23.png added by sha1 (29KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (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 (Posted a comment)
  • -email is unavailable- added by sha1 (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-18 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-04-03 rik5 StatusNone Patch Submitted
    2017-04-03 cdf Attached File- Added ode23.m, #40241
        Attached File- Added runge_kutta_interpolate.m, #40242
    2017-01-10 cdf Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
    2017-01-10 cdf Assigned toNone cdf
    2017-01-10 sha1 Attached File- Added Test_ode23.m, #39422
        Attached File- Added Test_ode23.png, #39423

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code