Karim Belabas on Thu, 16 Feb 2012 02:06:45 +0100

 Re: Complex AGM

```Package: pari
Version: since f59d9e0c [2005]

* Bill Allombert [2012-02-16 01:11]:
> On Wed, Feb 15, 2012 at 03:24:21PM +0000, John Cremona wrote:
> > For a definition of what "optimal" means and why it matters for
> > elliptic curve period computations, see http://arxiv.org/abs/1011.0914
> >
> > I am pretty sure that taking the principal square root will never give
> > a sequence converging to zero.  Using the optimal branch always gives
> > the largest limit (and hence the smallest periods), though there is al
> > ittle more to the question than that.
>
> In theory, I agree that should converge, but in practice (git-9749657)
>
> parisize = 8000000, primelimit = 500509
> ? agm(.1+I/1000,1)
>   ***   at top-level: agm(.1+I/1000,1)
>   ***                 ^----------------
>   *** agm: the PARI stack overflows !

That's quite unrelated, the bug is in precision(), precrealexact() to be
precise.

(01:45) gp > agm(.1+I/1000.,1)
^------ important !
time = 0 ms.
%1 = 0.42504345251657375080360809311316525277 + 0.0011373632973048871855491442682160760332*I

Looking at that function precrealexact() [ which I wrote about 7 years ago ],
I have no idea why it should ever have been useful or necessary. As I see it
now,

precision(t_COMPLEX with a *small, exact* component [= t_FRAC])

is just broken (larger than it should be).

The bug never surfaced because agm1() seems to be the only function using
'precision' with t_COMPLEX inputs to ensure termination. (In that case an
unachievable accuracy is required.)

And AGM is basically untested:

(2:02) colibri-kb% grep agm src/test/in/*
src/test/in/compat:agm(1,2)
src/test/in/compat:agm(1+o(7^5),8+o(7^5))
src/test/in/compat:logagm(2)
src/test/in/trans:agm(1,2)
src/test/in/trans:agm(1+O(7^5),8+O(7^5))

I'll have another look tomorrow [and add tests] :-)

Cheers,

K.B.

P.S: For the record: the threshold used to switch between log / logagm
for t_COMPLEX inputs is unrelated to the input accuracy... :-(
Bug number 2.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`

```

• References:
• Complex AGM
• From: Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>
• Re: Complex AGM
• From: John Cremona <john.cremona@gmail.com>
• Re: Complex AGM
• From: Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>