Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are many reasons, why errors occur for the above code, it is hard to guess which is the first one, the one given by the interpreter. First of all, the following works in the sense of the title, and is closest to the posted code:

sage: K.<a> = GF(2^3)
sage: a.minpoly()
x^3 + x + 1
sage: K.modulus()
x^3 + x + 1
sage: R.<x> = PolynomialRing( K )
sage: L.<b> = K.extension( x^2 + (a^2+a+1)*x + a^2 )
sage: L.order()
sage: b.minpoly()
x^2 + (a^2 + a + 1)*x + a^2
sage: L.modulus()
b^2 + (a^2 + a + 1)*b + a^2
sage: L.base()
Univariate Polynomial Ring in b over Finite Field in a of size 2^3

Let us compare with:

GF( K, 'modulus=x^2+(a^2+a+1)*x+a^2' );    # errors

The first argument of GF is... a field, not a prime power.

The second argument is... not optional, but a string, and inside the string there is a substring modulus... No chance.


Now the above sample lines produce a field L where a, b liven in, but it is not simple to work there. For instance, if one calls the multiplicative order on b, there are problems. So it may be better to first construct in a row L as the field with 2^6 elements, then pick inside two elements playing the roles of a and b. (Instead of L, a, b the following code uses the notations M, A, B.)

sage: M = GF( 2^6 )
sage: R.<x> = PolynomialRing( M )
sage: A = ( x^3 + x + 1             ).roots( multiplicities=False )[0]
sage: B = ( x^2 + (A^2+A+1)*x + A^2 ).roots( multiplicities=False )[0]

sage: B.multiplicative_order()
sage: A.multiplicative_order()

sage: A.minpoly()
x^3 + x + 1
sage: B.minpoly()    # over the prime field
x^6 + x^5 + x^2 + x + 1