# span of vectors over an extension field but with coefficients from the base field

Hi all,

Assume I have a vector space with coefficients from a finite extension field. How can I make the sub space spanned by vectors over that extension field but with coefficients from the base field? When I do something like this:

sage: F = GF(2)
sage: FF.<a> = F.extension(4)
sage: VS = VectorSpace(FF, 6)
sage: span([VS.random_element() for i in range(3)], F)


I get an error that "is not compatble with base_ring". But if I would replace VS with VS = FreeModule(ZZ, 6) it works. But that is not what I want. Are there any solutions?

edit retag close merge delete

Sort by » oldest newest most voted

(it would help if you'd format your question so that code displays nicely and can readily pasted in to sage)

The problem is that when you ask span(...,F), then sage wants to make an F-vector space. If you give it 6-dimensional vectors over FF, then sage will try to make then 6-dimensional vectors over F. Sage doesn't know how to do that, because it will try to make 6-dimensional vectors by forcing each entry into F (which doesn't work for elements of FF).

It does work for VS = FreeModule(ZZ, 6) because there is a homomorphism ZZ->F that sage is willing to use (hence, the result you get is a 3-dimensional subspace of F^6).

I don't think sage has direct support for F-vector spaces presented as subsets of FF-vector spaces. You can map a 3-dimensional F-vector space into it, though, so perhaps that is sufficient for your purposes.

sage: W=span([VS.random_element() for i in range(3)], FF)
sage: assert W.dimension() == 3
sage: F3=VectorSpace(F,3)
sage: phi=F3.hom(W.basis())
sage: phi
Vector space morphism represented by the matrix:
[1 0 0]
[0 1 0]
[0 0 1]
Domain: Vector space of dimension 3 over Finite Field of size 2
Codomain: Vector space of degree 6 and dimension 3 over Finite Field in z4 of size 2^4
Basis matrix:
[            1             0             0             0   z4^3 + z4^2     z4^3 + z4]
[            0             1             0        z4 + 1   z4^3 + z4^2             0]
[            0             0             1 z4^3 + z4 + 1             0 z4^3 + z4 + 1]

more