You should know that the bases of Y
is a matroid, that is, for any base B2
of Y
and any independent set B1
of Y
, you can pick some elements of B2
and add them to B1
to form a new basis, and this can be done greedily.
Here is how i will do such a case:
First define the two bases B1
and B2
:
sage: B1 = d1.right_kernel().basis()
sage: B1
[
(1, 0, 0, 0, 0, 0, 0, 0, 1, 1),
(0, 1, 0, 1, 0, 1, 0, 1, 0, 1),
(0, 0, 1, 1, 0, 1, 0, 1, 1, 0),
(0, 0, 0, 0, 1, 1, 0, 1, 1, 0),
(0, 0, 0, 0, 0, 0, 1, 1, 1, 0)
]
sage: B2 = d2.column_space().basis()
sage: B2
[
(1, 1, 0, 1, 1, 0, 0, 0, 0, 0),
(0, 0, 1, 1, 1, 0, 0, 0, 0, 0)
]
Note that B1
and B2
are not lists, but immutable Sequences
(in particular you can not append new vectors to B2
). The quick way is the following:
sage: B = list(B2)
sage: for v in B1:
....: if v not in span(B):
....: B.append(v)
sage: B
[(1, 1, 0, 1, 1, 0, 0, 0, 0, 0),
(0, 0, 1, 1, 1, 0, 0, 0, 0, 0),
(1, 0, 0, 0, 0, 0, 0, 0, 1, 1),
(0, 1, 0, 1, 0, 1, 0, 1, 0, 1),
(0, 0, 0, 0, 0, 0, 1, 1, 1, 0)]
Which looks correct, but it is not completely satisfactory since the vectors do not belong to the same space:
sage: for v in B:
....: print v.parent()
Vector space of degree 10 and dimension 2 over Finite Field of size 2
Basis matrix:
[1 1 0 1 1 0 0 0 0 0]
[0 0 1 1 1 0 0 0 0 0]
Vector space of degree 10 and dimension 2 over Finite Field of size 2
Basis matrix:
[1 1 0 1 1 0 0 0 0 0]
[0 0 1 1 1 0 0 0 0 0]
Vector space of degree 10 and dimension 5 over Finite Field of size 2
Basis matrix:
[1 0 0 0 0 0 0 0 1 1]
[0 1 0 1 0 1 0 1 0 1]
[0 0 1 1 0 1 0 1 1 0]
[0 0 0 0 1 1 0 1 1 0]
[0 0 0 0 0 0 1 1 1 0]
Vector space of degree 10 and dimension 5 over Finite Field of size 2
Basis matrix:
[1 0 0 0 0 0 0 0 1 1]
[0 1 0 1 0 1 0 1 0 1]
[0 0 1 1 0 1 0 1 1 0]
[0 0 0 0 1 1 0 1 1 0]
[0 0 0 0 0 0 1 1 1 0]
Vector space of degree 10 and dimension 5 over Finite Field of size 2
Basis matrix:
[1 0 0 0 0 0 ...
(more)
It is doable, how are the subspaces given ? Could you provide a concrete example ?
@tmonteil I just updated the question with an example.