octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #37613] Octave precision/accuracy is much lowe


From: Rik
Subject: [Octave-bug-tracker] [bug #37613] Octave precision/accuracy is much lower for quadgk
Date: Wed, 25 May 2022 11:59:31 -0400 (EDT)

Follow-up Comment #32, bug #37613 (project octave):

The discussion is somewhat unwieldly split between this bug report and bug
#62468.  I'll comment on the accuracy provision here.

I tried to create a test case that would exercise the bit of code in
__quadgk_eval__ that set the "too_close" output.  This turned out to be harder
than I thought.  First, I used Michael's corrected expression testing for 100
eps1.  Then, I added a call to warning() so that I would get a sense of how
many times this piece of code was activated.


  if (any (abs (diff (x, [], 2) ./ max (abs (x), [], 2)) < 100 * eps1))
  #if (any (abs (diff (x, [], 2) ./ max (abs (x), [], 2))) < 100 * eps1)
    warning ("hit too close");
    too_close = true;
    q = 0;
    err = 0;
    return;
  endif


It turns out, not at all.  I tried with various integrands, and I could not
get this code to execute.  Next, I tried cranking up the tolerances to make
quadgk work hard to get the correct answer.  I tried setting "RelTol" to 0
which didn't do anything, and so I tried additionally setting "AbsTol" to eps.
 At this point the function stopped with a different warning:


warning: quadgk: maximum interval count (650) exceeded


I tried increasing the "MaxIntervalCount" to 1e6, but I was still not able to
activate this code.  Finally, I tried directly loosening the criteria for the
"too close" condition


  if (any (abs (diff (x, [], 2) ./ max (abs (x), [], 2)) < 1e8 * eps1))


Then with this test case I was finally able to have the code activate.


quadgkv (@(x) sin (x), 0, 1, 'reltol', 0, 'abstol', eps, 'maxintervalcount',
1e6)
warning: hit too close
warning: called from
    quadgkv>__quadgk_eval__ at line 540 column 5
    quadgkv at line 410 column 24

error: q_subs(294656): out of bound 1 (dimensions are 1x1)


But, as you will notice, there was an error.  When the "too close" code is hit
it sets "q = 0", but q, in general, should not be a scalar but a size which
depends on the number of columns in the "subs" input.

I haven't gone any farther.  This code has never been active in Octave, throws
errors when it is activated, and does not have a theoretical basis for
existence.  I'm in agreement with Michael that it should be removed.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?37613>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]