1 | initial version |
I do not know how you succeed to build such a matrix without getting an error (some rows are missing), but in any case, there is no eigenspaces
method since a matrix generally acts differently on the right or on the left, so there is some ambiguity. Instead, you should use the eigenspaces_left
and eigenspaces_right
methods, for example:
sage: A = Matrix(GF(2),[[1,1,0],[0,1,0],[1,1,1]])
sage: A
[1 1 0]
[0 1 0]
[1 1 1]
sage: p=A.charpoly()
sage: p.factor()
(x + 1)^3
sage: A.eigenspaces_right()
[
(1, Vector space of degree 3 and dimension 1 over Finite Field of size 2
User basis matrix:
[0 0 1])
]
sage: A.eigenspaces_left()
[
(1, Vector space of degree 3 and dimension 1 over Finite Field of size 2
User basis matrix:
[0 1 0])
]
2 | No.2 Revision |
I do not know how you succeed to build such a matrix without getting an error (some rows are missing), but in any case, there is no eigenspaces
method since a matrix generally acts differently on the right or on the left, so there is some ambiguity. Instead, you should use the eigenspaces_left
and eigenspaces_right
methods, for example:
sage: A = Matrix(GF(2),[[1,1,0],[0,1,0],[1,1,1]])
sage: A
[1 1 0]
[0 1 0]
[1 1 1]
sage: p=A.charpoly()
sage: p.factor()
(x + 1)^3
sage: A.eigenspaces_right()
[
(1, Vector space of degree 3 and dimension 1 over Finite Field of size 2
User basis matrix:
[0 0 1])
]
sage: A.eigenspaces_left()
[
(1, Vector space of degree 3 and dimension 1 over Finite Field of size 2
User basis matrix:
[0 1 0])
]
EDIT With the updated matrix, you get:
sage: E = A.eigenspaces_right() ; E
[
(1, Vector space of degree 16 and dimension 8 over Finite Field of size 2
User basis matrix:
[1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1]
[0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0]
[0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1]
[0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0]
[0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0]
[0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0]
[0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0]
[0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1])
]
Since A
is invertible, you only get one eigenspace (for the eigenvalue 1
), so you get a list, you can get its first (unique) entry as follows:
sage: E[0]
(1, Vector space of degree 16 and dimension 8 over Finite Field of size 2
User basis matrix:
[1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1]
[0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0]
[0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1]
[0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0]
[0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0]
[0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0]
[0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0]
[0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1])
Which is a tuple (eigenvalue, eigenspace). Tp get the eigenspace, you can do:
sage: V = E[0][1] ; V
Vector space of degree 16 and dimension 8 over Finite Field of size 2
User basis matrix:
[1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1]
[0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0]
[0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1]
[0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0]
[0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0]
[0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0]
[0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0]
[0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1]
so if you want the basis of this vector space as a matrix, you just have to do:
sage: V.matrix()
[1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1]
[0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0]
[0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1]
[0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0]
[0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0]
[0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0]
[0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0]
[0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1]
Or, in a single command:
sage: A.eigenspaces_right()[0][1].matrix()
[1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1]
[0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0]
[0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1]
[0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0]
[0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0]
[0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0]
[0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0]
[0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1]