Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

(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]