Loïc Grenié on Tue, 01 Apr 2014 14:25:45 +0200


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

Re: precision in roots()


2014-04-01 14:17 GMT+02:00 Peter Bruin <P.Bruin@warwick.ac.uk>:
> Hello,
>
> It seems that the PARI library function corresponding to polroots(),
>
> GEN roots(GEN pol, long prec)
>
> uses a mix of the parameter prec and the current GP precision:
>
> gp > f = x^2 + 1;
> gp > install(roots, "GL")
> gp > roots(f, 2)
> %3 = [0.E-19 - 1.0000000000000000000*I, 0.E-19 + 1.0000000000000000000*I]~
> gp > roots(f, 4)
> %4 = [0.E-38 - 1.0000000000000000000000000000000000000*I, 0.E-38 + 1.0000000000000000000000000000000000000*I]~
> gp > roots(f, 8)
> %5 = [0.E-115 - 1.0000000000000000000000000000000000000*I, 0.E-115 + 1.0000000000000000000000000000000000000*I]~
> gp > \p96
>    realprecision = 96 significant digits
> gp > roots(f, 8)
> %6 = [0.E-115 - 1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*I, 0.E-115 + 1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*I]~
>
> In result %5, the real part does reflect the precision parameter, but
> the imaginary part seems to be limited by the GP precision.  Is this
> intended?  (It also affects nfinit(), bnfinit() etc.)

    No, it has the required precision but is *printed* accorded to the GP
  precision. Try

precision(imag(%5[1]))

       Loïc