[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #37414] Some minor bugs in quadcc
From: |
Pedro Gonnet |
Subject: |
[Octave-bug-tracker] [bug #37414] Some minor bugs in quadcc |
Date: |
Sat, 22 Sep 2012 12:06:31 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1 |
Follow-up Comment #2, bug #37414 (project octave):
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 :)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?37414>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/