[GAP Forum] Help needed with function Factors
Alexander Hulpke
hulpke at math.colostate.edu
Thu Mar 18 21:17:14 GMT 2010
Dear forum, Dear Jaco Versfeld,
> I want to factor a polynomial in GF(2^3).
>
> gap> f := GF(8);
> GF(2^3)
> gap> y := Indeterminate(f);
> x_1
> gap> pol := y^7 + Z(2)^0;
> x_1^7+Z(2)^0
> gap> Factors(pol);
> [ x_1+Z(2)^0, x_1^3+x_1+Z(2)^0, x_1^3+x_1^2+Z(2)^0 ]
>
> However, I expect the result to be all the non-zero elements in GF(2^3). What am I missing?
Polynomials in GAP are defined for a Family (typically, these are all elements of finite fields for a particular characteristic), but factorization is done by default over the field of coefficients, which often is just the prime field. (The reason for doing so, is that often it is not desired, and certainly more expensive, to construct the splitting field.) In your example, the indeterminate `y' is actually defined for characteristic 2, and the coefficient field of the polynomial is GF(2).
You can of course factor over larger fields, by specifying the appropriate polynomial ring (you need to specify a polynomial ring, not the field over which it is defined, because factorization happens in the polynomial ring.) In your example, this can be done in the following way.
gap> Factors(PolynomialRing(GF(8)),pol);
[ x_1+Z(2)^0, x_1+Z(2^3), x_1+Z(2^3)^2, x_1+Z(2^3)^3, x_1+Z(2^3)^4,
x_1+Z(2^3)^5, x_1+Z(2^3)^6 ]
gap> Factors(PolynomialRing(GF(16)),pol);
[ x_1+Z(2)^0, x_1^3+x_1+Z(2)^0, x_1^3+x_1^2+Z(2)^0 ]
If you instead want roots, the command `RootsOfUPol' (possibly indicating the field) will work:
gap> RootsOfUPol(pol);
[ Z(2)^0 ]
gap> RootsOfUPol(GF(8),pol);
[ Z(2)^0, Z(2^3), Z(2^3)^2, Z(2^3)^3, Z(2^3)^4, Z(2^3)^5, Z(2^3)^6 ]
> (How can I evaluate p for Z(2^3)^2, for instance?)
the operation `Value' will work for the polynomial and any element in characteristic 2:
gap> Value(pol,Z(8)^5);
0*Z(2)
gap> Value(pol,Z(32)^5);
Z(2^5)^10
I hope this is of help,
Alexander Hulpke
-- Colorado State University, Department of Mathematics,
Weber Building, 1874 Campus Delivery, Fort Collins, CO 80523-1874, USA
email: hulpke at math.colostate.edu, Phone: ++1-970-4914288
http://www.math.colostate.edu/~hulpke
More information about the Forum
mailing list