Karim Belabas on Fri, 24 Jan 2014 12:37:38 +0100

 Re: poldisc() problem

[ By replying to an old message, I just sent this to the old @cr.yp.to address.
Resending to pari-dev ... ]

* Lorenz Minder [2010-01-19 07:49]:
> I'm having trouble with poldisc() in pari-svn. It works fine for me
> with pari-2.3.4:
>
> ? f = x^3 + Mod(2, 3)*x^2
> %1 = x^3 + Mod(2, 3)*x^2
> ? poldisc(f)
>   ***   at top-level: poldisc(f)
>   ***                 ^----------
>   *** poldisc: impossible inverse modulo: Mod(0, 3).
>   ***   Break loop: type <Return> three times, or Control-d, to go back to GP)

[ Sorry it took 3 years to acknowledge/fix this: your email somehow
disappeared from my mbox :-(. I just found it in the pari-dev archives...]

This is now fixed in master for Z/pZ,

(12:13) gp > f = x^3 + Mod(2, 3)*x^2;
(12:13) gp > poldisc(f)
%2 = Mod(0, 3)

But the solution is still fragile:

(12:13) gp > f = x^3 + Mod(2, 3)*Mod(y,y^2+1)*x^2;
(12:13) gp > poldisc(f)
***   at top-level: poldisc(f=x^3+Mod(2,
***                 ^--------------------
*** poldisc: impossible inverse in Fl_inv: Mod(0, 3).

This is of course due to the fact that the "base ring" over which everything
makes sense is undefined to PARI, which only sees vectors of coefficients
and (in that case) does not even try to make sense out of them. So we have

(12:13) gp > f'
%3 = 3*x^2 + Mod(Mod(1, 3)*y, y^2 + 1)*x + Mod(Mod(0, 3), y^2 + 1)

and the leading coefficent '3' ( = Mod(0, 3) ) will cause problems.

Simple workaround for *some* instances:

(12:13) gp > f *= Mod(1, characteristic(f));
(12:13) gp > poldisc(f)
%5 = Mod(0, 3)

More generally, make sure the base ring is a domain, and *all* coefficients
explicitly belong to it (with the relevant t_POLMOD / t_INTMOD / t_FFELT)
without expecting type coercion to fix problems magically. (It won't :-()

Cheers,

K.B.
--
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/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`