Karim Belabas on Tue, 03 Jul 2018 14:32:46 +0200


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

Re: Truncation Precision in PARI


* kevin lucas [2018-07-03 14:12]:
> I have been trying to evaluate the following integral:
> intnum(x=0,1,frac(1/x)^3)
> but keep getting the following errors.
> intnum(x=0,1, frac(1/x)^3)
>  ***   at top-level: intnum(x=0,1,frac(1/x))
>  ***                              ^----------
>  ***   in function frac: intnum(x=0,1,frac(1/x)^3)
>  ***                                  ^------------
>  *** frac: precision too low in truncr (precision loss in truncation).
>  ***   Break loop: type 'break' to go back to GP prompt
> 
> How should I go about removing such messages?

In intnum(), you can't: the function assumes the integrand is analytic in a
(complex) neighbourhood of the integration interval.

Rewrite the integral as
  \sum_{k >= 1} \int_{1/(k+1}}^{1/k}  frac(1/x)^3 dx
= \sum_{k >= 1} \int_{1/(k+1}}^{1/k}  (1/x - k)^3 dx
= \sum_{k >= 1} (1 - 3*k - 6*k^2) / (2*k+2) + 3*k^2 * log(1 + 1/k)

And you can sum the latter numerically :

(14:27) gp > sumnum(k = 1, (1 - 3*k - 6*k^2) / (2*k+2) + 3*k^2 * log(1 + 1/k))
%1 = 0.1847322430582944847906211557329009617183078736112397934966608159153612659664078742850607610385012363

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 21 23
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`