Karim BELABAS on Tue, 18 Jun 2002 17:05:44 +0200 (MEST)


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

Re: intnum


On Tue, 18 Jun 2002, Bill Allombert wrote:

> On Mon, Jun 17, 2002 at 07:31:31PM +0200, Karim BELABAS wrote:
> > Received the following bug report:
> >
> > (19:10) gp > intnum(x=0,Pi,sin(16*x)^2)
> > %1 = 1.855125350366532182 E-54  \\ should be Pi/2
> >
> > Cause: integral computed using Romberg method, with equally spaced points
> > (+ interpolation of successive values for a few runs with increasing number
> > of points). For highly oscillating functions (esp. integrating over 2^k *
> > period), we may be unlucky.
> >
> > Possible solution: pick random point in each subinterval ?
>
> ? intnum(x=0,Pi,sin(16*x)^2,3)
> %1 = 1.570796326794896619231321691
>
> So what trick does this flag use ?

The subdivision is different. This time it's killed by powers of 3:

(17:03) gp > intnum(x=0,Pi,sin(3^4*x)^2,3)
%1 = 3.141592653589793238462643383  \\ answer is still Pi/2

(17:04) gp > intnum(x=0,2*Pi,sin(3^4*x)^2,3)
%2 = 1.195456135736584191384104720 E-51 \\ sic.

    Karim.
-- 
Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathematiques, Bat. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas/
--
PARI/GP Home Page: http://www.parigp-home.de/