Bill Allombert on Mon, 28 Apr 2008 23:37:24 +0200


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

Re: polmod ^ 0 loses base field modulo?


On Mon, Apr 28, 2008 at 02:45:49AM +0200, Carlo Wood wrote:
> Hi all!
> 
> I'm very new to PARI/gp (since yesterday), so probably (hopefully)
> I'm doing something wrong.  Nevertheless, I really don't understand
> what that would be.
> 
> Here is what I did:
> 
> ? T12 = Mod(1,2)*t^12 + Mod(1,2)*t^3 + Mod(1,2);
> ? g12 = Mod( Mod(1,2)*t^9 + Mod(1,2)*t^8 + Mod(1,2)*t^7 + Mod(1,2)*t^4 + Mod(1,2)*t^2 + Mod(1,2)*t, T12 );
> 
> Now g12 is a generator of the field F_2[t]/<t^12+t^3+1>.
> 
> Then I did:
> 
> ? g = g12^0
> %10 = Mod(1, Mod(1, 2)*t^12 + Mod(1, 2)*t^3 + Mod(1, 2))
> 
> This SHOULD be the unity of said field, however:

? a = (g + 1/g)
%12 = Mod(2, Mod(1, 2)*t^12 + Mod(1, 2)*t^3 + Mod(1, 2))

Yes, this is a known problem: if P is a polynomial, P^0 always return 1.

For polynomials, the only work around is to avoid to use ^0.

In the development version of PARI (2.4.2), you can define true finite
field elements which does not have this issue:
? T12 = Mod(1,2)*t^12 + Mod(1,2)*t^3 + Mod(1,2);
? u = ffgen(T12,'u);
? g12 = u^9+u^8+u^7+u^4+u^2+u;
? g = g12^0
%4 = 1
? g+1/g
%5 = 0

Cheers,
Bill.
PS for Karim: maybe we should use ff_poltype to fix this bug.