Subject: how to "fool" Gauss-Kronrod 21-point rule
From: Raymond Toy
Date: Fri, 13 Apr 2012 15:32:48 -0700
On Fri, Apr 13, 2012 at 3:19 PM, Edwin Woollett <woollett at charter.net>wrote:
> On April 13, 2012, I wrote:
> ------------------------------**--
>
>> Thanks for the example, which my present quadpack wrapper
>> does successfully:
>> . . . .
>>
> -----------------------------
> A weird case of quad_qag behavior is that the factored
> form of the integrand is treated successfully, but expanded forms are not
> (5.26.0gcl, Windows, XMaxima):
>
> ------------------------------**----
> (%i1) display2d:false$
>
> (%i2) e1:4^(-16)/((x - %pi/4)^2 + 16^(-16));
>
> (%o2) 1/(4294967296*((x-%pi/4)^2+1/**18446744073709551616))
>
> (%i3) e2:expand(e1);
>
> (%o3) 1/(4294967296*x^2-2147483648*%**pi*x+268435456*%pi^2+1/**4294967296)
>
>
It's a numerical issue. e1 is clearly more accurate when x is near %pi/4.
Compare the value of e1 and e2 for x =.78539816. (If this doesn't cause a
problem, add a few for digits from %pi/4.).
For your tests, maybe you can replace the -16 with values like -32. This
makes the spike even narrower.
Ray