[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate r
From: |
Nicholas Jankowski |
Subject: |
[Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf |
Date: |
Wed, 4 May 2022 10:56:55 -0400 (EDT) |
Update of bug #62412 (project octave):
Severity: 3 - Normal => 2 - Minor
Status: None => Confirmed
Release: 6.2.0 => dev
Operating System: Microsoft Windows => Any
_______________________________________________________
Follow-up Comment #1:
as a comparison, in matlab 2022a:
>> integral(f,1,inf)
Warning: Reached the limit on the maximum number of intervals in use.
Approximate bound on error is 2.2e-03. The integral may not exist, or it
may be difficult to approximate numerically to the requested accuracy.
> In integralCalc/iterateScalarValued (line 372)
In integralCalc/vadapt (line 132)
In integralCalc (line 83)
In integral (line 87)
ans =
-9.993656849721580
So even matlab recognizes some issues with this one.
As the help describes, Octave's integral is a wrapper to quadcc, quadgk, or
quadv,selected based on the type of inputs/options chosen, and better accuracy
may be obtained by running them directly. quadv breaks on that one, but if I
run the other two manually in octave, it appears integral is choosing quadcc:
>> quadcc(f,1,inf)
ans = -9.784172499874394
>> quadgk(f,1,inf)
warning: quadgk: maximum interval count (650) exceeded
warning: called from
quadgk at line 393 column 7
warning: quadgk: Error tolerance not met. Estimated error 0.00605827
warning: called from
quadgk at line 404 column 5
ans = -9.990824621478369
>> quadgk(f,1,inf, "maxintervalcount", 100000)
warning: quadgk: non-finite integrand encountered
warning: called from
quadgk at line 348 column 7
warning: quadgk: Error tolerance not met. Estimated error 0.00178496
warning: called from
quadgk at line 404 column 5
ans = -9.994594924648961
funny enough, the best answer in Octave comes from just calling the 'old'
routine 'quad:
Octave:
>> quad(f,1,inf)
ans = -9.999999999999767
matlab:
>> quad(f,1,inf)
Warning: Infinite or Not-a-Number function value encountered.
> In quad (line 100)
ans =
NaN
it may be that there's some improvement that can be done in function
selection, but the goal when implementing integral was to get a compatible
function in place. it hasn't really been revisited for improvement since.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62412>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, anonymous, 2022/05/04
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf,
Nicholas Jankowski <=
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, Nicholas Jankowski, 2022/05/04
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, Rik, 2022/05/04
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, Nicholas Jankowski, 2022/05/04
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, John W. Eaton, 2022/05/04
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, Rik, 2022/05/04
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, Nicholas Jankowski, 2022/05/04
- [Octave-bug-tracker] [bug #62412] integral gives consistent inaccurate result for improper integral to inf, Rik, 2022/05/04
- [Octave-bug-tracker] [bug #62412] quadcc does not warn when quadrature fails to converge, Rik, 2022/05/04
- [Octave-bug-tracker] [bug #62412] quadcc does not warn when quadrature fails to converge, Nicholas Jankowski, 2022/05/04
- [Octave-bug-tracker] [bug #62412] quadcc does not warn when quadrature fails to converge, Michael Leitner, 2022/05/05