bugGNU Octave - Bugs: bug #37414, Some minor bugs in quadcc

 
 

bug #37414: Some minor bugs in quadcc

Submitted by:  None
Submitted on:  Thu 20 Sep 2012 04:31:33 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Inaccurate Result
Status: FixedAssigned to: None
Originator Name: Pedro GonnetOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 23 Sep 2012 05:48:58 PM UTC, comment #3:

I fixed this on the stable branch of Octave (http://hg.savannah.gnu.org/hgweb/octave/rev/c9954a15bc03). To access the fix you can build from Mercurial sources or wait until the next release. Thanks for reporting the problem and providing the code changes.

Rik <rik5>
Project Administrator
Sat 22 Sep 2012 12:06:31 PM UTC, comment #2:

Hi Rik,

Sure, here's an example of integrating a function, in this case sin(x), that has random occurrences of 'NaN' in it:

function y = mysin ( x )
y = sin(x);
ind = ceil( rand(1) * size(y) );
y(ind) = NaN;
end

Integrating the non-faulty function from -pi to pi gives, as expected, zero:

octave:2> [ q , err , npoints ] = quadcc( @sin , -pi , pi )
q = -2.8189e-17
err = 7.3915e-16
npoints = 95

Integrating the faulty function in the same interval does not converge at all:

octave:5> [ q , err , npoints ] = quadcc( @mysin , -pi , pi )
q = -0.026062
err = 2.1504
npoints = 167589

However, with the code fixes (fixed and re-compiled), the integrator gets to within 13 digits of the correct result:

octave:3> [ q , err , npoints ] = quadcc( @mysin , -pi , pi )
q = 3.7813e-14
err = 6.1902e-12
npoints = 198919

Incidentally, this is a nice example of the robustness of this code, at least in the corrected version, for an integrand at which all other codes fail :)

Pedro Gonnet <gonnetp>
Fri 21 Sep 2012 11:52:30 PM UTC, comment #1:

Can you post a test case that would exercise the bug as well? First, I would like to add the test to the list of built-in self tests. Second, I want to be able to verify that changing the lines as you suggest takes the behavior from failure to success.

Rik <rik5>
Project Administrator
Thu 20 Sep 2012 04:31:33 PM UTC, original submission:

I just got an e-mail from someone who found a bug in the c-language implementation of quadcc.

In lines 1718, 1847, 1992 and 2087 of quadcc.cc, the following
statements

iv->fx[i] = octave_NaN;
ivl->fx[i] = octave_NaN;
ivr->fx[i] = octave_NaN;

should be changed to

iv->fx[nans[i]] = octave_NaN;
ivl->fx[nans[i]] = octave_NaN;
ivr->fx[nans[i]] = octave_NaN;

respectively. I would have sent a diff-file, but I'm having trouble accessing the repository.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gonnetp (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 23 Sep 2012 05:48:58 PM UTCrik5CategoryNone=>Libraries
      StatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Fri 21 Sep 2012 11:52:30 PM UTCrik5StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1