# Normal base of a finite extersion field

Hi all,

any finite extension (say degree n) of a field K may be considered as vector space over K. In particular, the roots of any irreducible polynomial f of degree n over a finite field K constitute a basis of this vector space.

Does SageMath provide a routine to construct the vector space for given K and f?

Such a vector space seems to be used internally when constructing Kn=GF(K.order()^n,'a',modulus=f). If so then the question becomes: Is this vector space open to the public? And how can I use it?

edit retag close merge delete

Sort by » oldest newest most voted

Depending on the application, the one or the other way to introduce and use objects may be favorable. So i will suppose that the base field is a finite field, F, in the example having $11$ elements, so we work over $$\mathbb F_{11}\ .$$ With respect to the irreducible polynomial $f=X^5-X+1$ we build the extension $K$ of $F$, and let $x$ be the image of $X$, taken modulo $f$. Then we can start the following dialog with sage in the iron python interpreter:

sage: F = GF(11)
sage: R.<X> = PolynomialRing( F )
sage: f = X^5 - X + 1
sage: f.is_irreducible()
True
sage: K.<x> = GF( 11**5, modulus=f )
sage: V = K.vector_space()
sage: V
Vector space of dimension 5 over Finite Field of size 11
sage: V.basis()
[
(1, 0, 0, 0, 0),
(0, 1, 0, 0, 0),
(0, 0, 1, 0, 0),
(0, 0, 0, 1, 0),
(0, 0, 0, 0, 1)
]
sage: V.basis_matrix()
[1 0 0 0 0]
[0 1 0 0 0]
[0 0 1 0 0]
[0 0 0 1 0]
[0 0 0 0 1]
sage: V.base_field()
Finite Field of size 11
sage: k = K.random_element()
sage: k
8*x^3 + x^2 + 4
sage: V(k)
(4, 0, 1, 8, 0)


So applying the "class", the "convertor", the "constructor" V on an element of the field K implements the forgetful functor from $K$ to $V$.

In characteristic zero, over $$\mathbb Q$$ the above has to be changed slightly.

Sample code:

sage: R.<X> = QQ[]
sage: K.<x> = NumberField( X^3 + X + 1 )
sage: V, from_V, to_V = K.vector_space()
sage: from_V
Isomorphism map:
From: Vector space of dimension 3 over Rational Field
To:   Number Field in x with defining polynomial X^3 + X + 1
sage: to_V
Isomorphism map:
From: Number Field in x with defining polynomial X^3 + X + 1
To:   Vector space of dimension 3 over Rational Field
sage: to_V(1)
(1, 0, 0)
sage: to_V(x)
(0, 1, 0)
sage: to_V(x^2)
(0, 0, 1)
sage: to_V(x^3)
(-1, -1, 0)
sage: a = 2018*x + 1
sage: a.norm()
-8213877507
sage: matrix( QQ, 3, 3, [ to_V( a*x^k ) for k in [0,1,2] ] ).det()
-8213877507


The information above in the line V, from_V, to_V = K.vector_space() is taken from

sage: R.<X> = QQ[]
sage: K.<x> = NumberField( X^3 + X + 1 )
sage: K.vector_space?


and it is always a good idea to investigate in this way the doc(umentation) strings for the methods of some existing instances. In this case, after K. i was hitting the TAB (sometimes one has to do this twice), got a list of methods, saw the vector_space among them, then added the question mark to see if it is helpful for the given situation, yes it was.

more

Thanks, calling 'vector_space' on 'K' is the crucial point. BTW, I read the documents in "sage/rings/finite_rings/finite_field_constructor.py" and many others up and down looking for all occurrences of 'def ' (restricted to these since I was looking for a method definition) but did not find something related to my question. Now I did it a second time and see 'V = k.vector_space()' is an example comment in "sage/rings/finite_rings/finite_field_ntl_gf2e.py" (probably, also in some other files). My failure was to ignore comments.

( 2018-03-01 04:43:27 -0600 )edit