quad_qag(...) error message



Edwin Woollett wrote:
> On Sept. 25, Raymond Toy wrote:
> 
> 
>>> The exact result is 0 which makes the relative error calculation
>>> undefined.
>>> (I don't remember quadpack's definition of relative error offhand.)
>>
>> I looked it up.  Quadpack computes
>>
>> errbnd = max(epsabs, epsrel*abs(result))
>>
>> This is used to determine if we've converged or not.  But since result
>> is always 0, errbnd is always 0 (because epsabs is 0).  This is compared
>> to the estimated abserr to determine convergence.
>>
> Thanks for the information about convergence decisions
> 
> 
> Is there an example of  an integrand and interval
> for which the setting of epsabs makes any
> difference??
> 
> When I attempt to influence this parameter in the
> example  f(x) = x over (-1,1) with ans = 0,
> I see no change in the error message no matter what
> value I attempt to assign. (Maybe my syntax is
> wrong?)
> 
> ---------------------------------------------------
> "DEFAULT"  EPSABS CASE
> 
> ("0";  This can't be a floating point criterion in
> the original fortran code. Up to now I
> assumed it meant "0 to whithin floating
> point precision".)

If you look at the code and understand what epsabs means, it is
precisely that.  It means if the estimated absolute error is below
epsabs, we have converged.  There are other conditions, but this is one
of them.

> ---------------------------------------------
> "MEDIUM" EPSABS  = 1d-8
> 
> (%i16) for i thru 6 do
>         (qlist:quad_qag(x,x,-1,1,i, 'epsabs=1d0-8),
>             print("key is ",i," ",qlist ) )$
> 
> key is  1   [0.0, 1.1020760842711039E-14, 15, 2]

Interesting.  My copy of maxima says

key is  1   [0.0, 1.102076084271104e-14, 15, 0]

That is, no error.
> 
> Consider a harder integral:
> 
> f(x) = sqrt(x)*log(1/x) over (0, 1)
> 
> I get no bad error code, but
> the value of epsabs does not
> affect the precision of the result
> nor the number of function evaluations.

Dont' forgot that there's also epsrel, which defaults to 1d-10.  To
understand the termination criteria, you'll have to read the fortran
code in dqagse.f, especially the parts where it determines if there are
roundoff issues.  It looks a bit complicated.  I think this is explained
better in the Quadpack book.

When I change epsrel to something larger, the number of evaluations
decreases, and the estimated error increases.

Ray