bugGNU Octave - Bugs: bug #47596, [octave forge] (odepkg) constant...

 
 

bug #47596: [octave forge] (odepkg) constant mass matrix option is not implemented correctly

Submitted by:  Guillaume Bruand <gbruand>
Submitted on:  Fri 01 Apr 2016 12:09:36 PM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: In ProgressAssigned to: Carlo de Falco <cdf>
Originator Name: Open/Closed: Open
Release: 4.0.0Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 25 Nov 2016 08:46:22 PM UTC, comment #5:

Unfortunately this bug is also present in the ode45 function released with Octave 4.2.0.

I have attached a somewhat different patch against the 4.2.0 version of ode45.m.

(file #39074)

Bill Greene <billgreene>
Thu 07 Jul 2016 06:43:56 AM UTC, comment #4:

Jacopo,

Was this change ever actually applied in odepkg/core?

c.

Carlo de Falco <cdf>
Project MemberIn charge of this item.
Tue 05 Apr 2016 09:02:55 AM UTC, comment #3:

Guillaume, hanks for checking!

@Jacopo could you please apply the suggested changes
to ode45 and ode23?

rather than computing the inverse, especially for a sparse
Jacobian, I would recommend computing and storing the factorization.

Carlo de Falco <cdf>
Project MemberIn charge of this item.
Mon 04 Apr 2016 07:58:40 AM UTC, comment #2:

The problem is also present in the development version; we must care to not forget the mass matrix when computing the solution. In ode45.m, line 262 :

the mass matrix is defined in the constant case but not used. I suggest to use the parameter "fun" the same way a dynamic mass matrix is handled, e.g. line 301, add the bottom lines :

Do not forget to uncomment the mass matrix line 268 (it will be equal to identity)

Guillaume Bruand <gbruand>
Sat 02 Apr 2016 05:47:03 AM UTC, comment #1:

thanks for reporting this.

the development version of odepkg has undergone
a significant rewrite and many solvers have been
refactored to avoid code duplication.

furthermore some solvers are being moved to core
octave, and ode45 that you mention in your report
is one of them.

can you please check whether the bug also applies
to the development version of core octave?

you can find the relevant souces here:
http://hg.savannah.gnu.org/hgweb/octave/file/fa58fcb7c51d/scripts/ode/

Carlo de Falco <cdf>
Project MemberIn charge of this item.
Fri 01 Apr 2016 12:09:36 PM UTC, original submission:

Package : odepkg v0.8.5
Functions : any solver (ode45, ode54, etc) used in the package

Description :
Any use of the 'Mass' option with one of the solver (though the settings function 'odeset') will fail if the mass matrix is constant; the function runs without error/warning but the result is incorrect.

This problem does not occur when a function handle @mass is passed as the mass option.

Fix :
The change must be done in every solver. For example in ode54.m, line 232, mass definition must be uncommented :
to become :

and then used line 367 :
must be changed into

Important remark : in the case of a constant matrix we dont need to perform a matrix division at each solver step, because the computation time will greatly increase. It is better to compute the inverse of the mass matrix before the main loop, and then do a multiplication (rather than a matrix division). This gives :

l.227 :

and line 356 :

Guillaume Bruand <gbruand>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #39074:  ode45.patch added by billgreene (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cdf
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by billgreene (Updated the item)
  • -unavailable- added by cdf (bug in ode45 / ode23)
  • -unavailable- added by cdf (Posted a comment)
  • -unavailable- added by gbruand (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 14 Aug 2017 01:41:40 PM UTCcdfAssigned toNone=>cdf
    Mon 14 Aug 2017 01:41:23 PM UTCcdfCarbon-Copy-=>Added -unavailable-
    Sun 13 Aug 2017 12:49:58 PM UTCjweSummaryodepkg v0.8.5 : constant mass matrix option is not implemented correctly=>[octave forge] (odepkg) constant mass matrix option is not implemented correctly
    Fri 25 Nov 2016 08:46:22 PM UTCbillgreeneAttached File-=>Added ode45.patch, #39074
    Tue 05 Apr 2016 09:03:40 AM UTCcdfCarbon-Copy-=>Added -unavailable-
    Tue 05 Apr 2016 09:02:55 AM UTCcdfStatusNeed Info=>In Progress
    Sat 02 Apr 2016 05:47:03 AM UTCcdfStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1