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

 
 

bug #50012: ode23 internal interpolation

Submitted by:  Andreas Stahel <sha1>
Submitted on:  Tue 10 Jan 2017 09:38:04 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Inaccurate Result
Status: FixedAssigned to: Carlo de Falco <cdf>
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission 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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project 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>
Project 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>
Project MemberIn charge of this item.
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>
Project 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>
Project MemberIn charge of this item.
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 File(s):
   
   
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
  • -unavailable- added by jcorno (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by cdf
  • -unavailable- added by cdf
  • -unavailable- added by cdf
  • -unavailable- added by cdf (Posted a comment)
  • -unavailable- added by sha1 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 18 Apr 2017 10:44:16 PM UTCrik5StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Mon 03 Apr 2017 03:24:50 PM UTCrik5StatusNone=>Patch Submitted
    Mon 03 Apr 2017 08:09:30 AM UTCcdfAttached File-=>Added ode23.m, #40241
      Attached File-=>Added runge_kutta_interpolate.m, #40242
    Tue 10 Jan 2017 10:41:29 AM UTCcdfCarbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added -unavailable-
    Tue 10 Jan 2017 10:39:49 AM UTCcdfAssigned toNone=>cdf
    Tue 10 Jan 2017 09:38:04 AM UTCsha1Attached File-=>Added Test_ode23.m, #39422
      Attached File-=>Added Test_ode23.png, #39423

    Back to the top


    Powered by Savane 3.1-cleanup1