Karim BELABAS on Thu, 14 Sep 2000 22:15:54 +0200 (MET DST)


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

Re: Inefficient "solve" in Pari 2.0.18 (beta) ?


[Will Galway:]
> The online documentation for "solve" says that Brent's method is used, 
> but the behavior is more like simple bisection, even for what I would
> consider to be very nice functions.  Try, for example
> 
>  testfunc(x) = print(x); sin(x)
>  solve(x= -0.1, 0.2, testfunc(x))
> 
> or
> 
>  testfunc(x) = print(x); x^2-1
>  solve(x= 0.8, 1.1, testfunc(x))
> 
> working with (default) 28-digit precision.

There is a typo in the code (standing there since at least 1.39.15,
and presumably from the earliest versions).

In line 1161 of langage/sumiter.c (line numbers assume version 2.0.18)
replace

      if (cmprr(a,b)==0)

by

      if (cmprr(a,c)==0)

The CVS repository has also been updated.

Cheers,

    Karim.
__
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://www.parigp-home.de/