Bill Allombert on Wed, 10 Nov 2021 13:01:27 +0100


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

Re: Pari query


On Wed, Nov 10, 2021 at 11:25:28AM +0000, Harvey Rose wrote:
> Dear Pari expert
>       I am trying to use factorff(x,a,p) and I keep getting error
>       messages.  For example I am wanting to factorise the polynomial
>       t^5+t^3+1 modulo 2 over the finite field of order 32 generated
>       by the polynomial t^5+t^2+1.  I am assuming that the field has
>       basis 1 and a, say, and the non-zero elements of the field can
>       be represented by the powers a^n for n between 1 and 31, or as a
>       vector space of dim 5 with basis elements (1,a, a^2,a^3,a^4).
> 
>      When I try the factorff function I keep getting the error message
>      : incorrect priority in factormod, variable x <=t. or something
>      very similar.  I have tried using Mod(-,2) as coefficients of the
>      polynomial x and/or polynomial p to no avail.  So when you have a
>      spare bit of time I would welcome any help here.

You need to use distinct variables for defining the polynomial and the
field, and the field variable must have lower priority than the
polynomial variable (x always have the highest priority).

So for example you can do
? factorff(x^5+x^3+1,a^5+a^2+1,2)
%2 =
[Mod(Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2))*x+Mod(Mod(1,2)*a^3+Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2)),1;Mod(Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2))*x+Mod(Mod(1,2)*a^3+Mod(1,2)*a+Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2)),1;Mod(Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2))*x+Mod(Mod(1,2)*a^3+Mod(1,2)*a^2+Mod(1,2)*a+Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2)),1;Mod(Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2))*x+Mod(Mod(1,2)*a^4+Mod(1,2)*a,Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2)),1;Mod(Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2))*x+Mod(Mod(1,2)*a^4+Mod(1,2)*a^3+Mod(1,2)*a^2+Mod(1,2)*a+Mod(1,2),Mod(1,2)*a^5+Mod(1,2)*a^2+Mod(1,2)),1]
? liftall(%)
%3 =
[x+(a^3+1),1;x+(a^3+a+1),1;x+(a^3+a^2+a+1),1;x+(a^4+a),1;x+(a^4+a^3+a^2+a+1),1]

Alternatvely, you can first define a finite field generator with 
a=ffgen((a^5+a^2+1)*Mod(1,2),'a)
and then do
factor(t^5+t^3+1,a)
%42 =
[t+(a^3+1),1;t+(a^3+a+1),1;t+(a^3+a^2+a+1),1;t+(a^4+a),1;t+(a^4+a^3+a^2+a+1),1]
This way you can escape the priority rule.

Cheers,
Bill.