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.