Karim BELABAS on Tue, 19 Jan 1999 18:56:36 +0100 (MET)


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

Re: nfgaloisconj() bug


[Igor:]
> it turned out to be a partial fix, because still:
> 
> ? nfgaloisconj(nfinit(x^3-x-1),1)
>   ***   bus error: bug in GP (please report).

The doc says (when describing the flag argument to nfgaloisconj): 

  1: as 0 but guaranteed to be complete if the field is Galois, otherwise
  there is an infinite loop;

The infinite loop then triggered a completely unrelated bug. Here's a "fix"
(you get the infinite loop instead of the SIGBUS...):

*** src/basemath/base1.c.orig   Mon Jan 18 18:35:40 1999
--- src/basemath/base1.c        Tue Jan 19 18:26:09 1999
***************
*** 783,789 ****
    y=cgetg(n+1,t_VEC); y[1]=(long)polx[v];
    for (i=2;;)
    {
!     av1=avma; fa=gtrunc(polr); init_conj(m,nf,fa,pe,v,n);
      for ( ; i<=n; i++)
      {
        coeff(m,1,n+1) = (long) centerlift(gneg_i(gmodulcp((GEN)fa[i],pe)));
--- 794,800 ----
    y=cgetg(n+1,t_VEC); y[1]=(long)polx[v];
    for (i=2;;)
    {
!     fa=gtrunc(polr); init_conj(m,nf,fa,pe,v,n); av1=avma;
      for ( ; i<=n; i++)
      {
        coeff(m,1,n+1) = (long) centerlift(gneg_i(gmodulcp((GEN)fa[i],pe)));

> Also, I noticed another thing, that goes back at least as far as
> 2.0.11:
> 
> ? nfgaloisconj(nfinit(x^4-2*x^2+9),0)
> [x, 1/3*x^3 - 2/3*x, -1/3*x^3 + 2/3*x, -x]
> ? nfgaloisconj(nfinit(x^4-2*x^2+9),2)
> [x, 0, 0, -x]
> 
> Correct me if I'm wrong, but from reading documentation, I don't see a
> reason why the output should depend on the flag.  Or are these 2
> output isomorphic to each other?

There's a difficult precision problem here. None of the generic nfgaloisconj
functions guarantee that all conjugates will be found. The default function
is more stable (integral LLL), but even there, bad things can happen. [we
assume the field is Galois if flag=1, and even abelian if flag=4]

>From the doc: 
  0: use p-adics, LLL on integral basis (some conjugates may be missing);
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2 & 3: use complex numbers, LLL on integral basis (not always complete)
                                                    ^^^^^^^^^^^^^^^^^^^^^
Two automorphisms were missed in the second case, which were luckily detected
by the default function.

   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://pari.home.ml.org