Ask Your Question

Revision history [back]

There is a problem since the a you are using seems to come from a previous computation.

At least on the last version of Sage, if you type

sage: K = GF(2^7,'a');

The python variable a does not point to the generator of K whose name is 'a'

sage: a
NameError: name 'a' is not defined

For this, you have to do:

sage: K.inject_variables()
Defining a

Then, everything seems to work:

sage: PK.<x>=K[];
sage: f = (a^6 + a^3 + a)*x^2 + (a^6 + a^4 + a^3)*x + (a^5 + a^4 + a^3 + a^2 + 1);
sage: print f.roots();
[(a^3 + a, 1), (a^5 + a^3 + a^2 + a, 1)]

There is a problem since the variable a you are using in your third line seems to come from a previous computation.

At least on the last version of Sage, if you type

sage: K = GF(2^7,'a');

The python variable a does not point to the generator of K whose name is 'a'

sage: a
NameError: name 'a' is not defined

For this, you have to do:

sage: K.inject_variables()
Defining a

Then, everything seems to work:

sage: PK.<x>=K[];
sage: f = (a^6 + a^3 + a)*x^2 + (a^6 + a^4 + a^3)*x + (a^5 + a^4 + a^3 + a^2 + 1);
sage: print f.roots();
[(a^3 + a, 1), (a^5 + a^3 + a^2 + a, 1)]