# polynomials in finite field: extracting coefficients

Hi i would like to go a bit deeper than this question

http://stackoverflow.com/questions/21...

F.<e> = GF(16)
p = e.minpoly()
p


x^4 + x + 1

R.<x> = PolynomialRing(F)
g=(x+e)*(x+e^14)
g in R

f=-((g(x)-g(e^2))/(x-e^2))*(1/g(e^2))
f in R
f


(e^3 + e^2 + e + 1)*x + e^3 + e

(1) it looks like f is not recognized as a polynomial as it was defined as a rational function which happened to simplify into a polynomial. As such, trying to use a method like f.list() or f.coeff() would cause an error

AttributeError: 'FractionFieldElement_1poly_field' object has no attribute 'degree'

(2) it happens that the coefficient for x is actually equal to e^12, and the constant coefficient is e^9 is there an option when working in GF(16) to display every element as a power of e instead of a linear combination of 1,e,e^2,e^3 ?

thanks

edit retag close merge delete

Sort by » oldest newest most voted

f is indeed a rational function, since it was defined as a fraction:

sage: f.parent()
Fraction Field of Univariate Polynomial Ring in x over Finite Field in e of size 2^4


You can convert it into a polynomial as follows:

sage: ff = R(f)
sage: ff
(e^3 + e^2 + e + 1)*x + e^3 + e
sage: ff.parent()
Univariate Polynomial Ring in x over Finite Field in e of size 2^4
sage: ff.list()
[e^3 + e, e^3 + e^2 + e + 1]


For your second question you can get the exponents you want using the rank method. However, i am not sure you can change the default representation easily.

sage: [c.rank() for c in ff.list()]
[9, 12]

more