Richard Puttock asked:
I am trying to factorise univariate polynomials over Z_p where p is
prime. So I type
`UnivariatePolynomial' creates a polynomial *over* the ring which is given
as the first argument. In your situation, you create a polynomial whose
coefficients would be polynomials again. GAP can not factor such iterated
Furthermore, GAP distinguishes between finite field elements and integers.
You'd have to multiply with the appropriate ``1'' to get the proper elements.
If you construct the polynomial as:
The factorization will work:
gap> f:=Factors(r,p); [ Z(13)+Z(13)*x, Z(13)^5+x, Z(13)^9+x ]
(Finally, you might want to use the operation `Int' to convert finite field
elements back to integers.)
gap> coeffs:=CoefficientsOfUnivariatePolynomial(f); [ Z(13)^5, Z(13)^0 ] gap> List(coeffs,Int); [ 6, 1 ]
I hope this is of help,