Diagonalisability check Malfunctioning [closed]
I ran the following code:
A = matrix(QQbar, [[2,-1,0],[-1,2,1],[0,-1,2]]);
D, P = A.diagonalization()
This generated a value error saying that A is not diagonalisable. To see if there are workarounds, I replaced the diagonalization
method by eigenmatrix_right()
, and the results were weird.
D
was twice the identity matrix, and P
had zero vectors in its creation. I think writing QQbar
to make the thing work in algebraic numbers is not proving fruitful at all, because replacing it with QQ
yields exactly the same result.
UPD1: I thought that the issue might lie with the implementation of QQbar
, so I tried it Q[sqrt(2)]
instead, which does indeed contain the eigenvalues of my matrix: 2, 2 + \sqrt(2), 2 - \sqrt(2)
, and the entries of the corresponding eigenvectors as well, but to no avail. I think it's the matrix construction mechanism itself which is faulty here. Unless addressed soon, I suppose I would remove the QQbar
tag from the question then.
UPD2: Closed, A wasn't entered correctly, was the issue.
Maybe this is a silly question, but why do you think that this matrix is diagonalizable? All of its eigenvalues are 2, and it only seems to have a one-dimensional subspace of eigenvectors.
In the last paragraph, what do you mean by
D
andP
? They can't have been the values returned byA.diagonalization()
, since that fails.I am assuming you took Sage's word for it. It is not returning correct values though, which is my complaint to begin with. Please note that the matrix in question is a symmetric real matrix, and is thus certainly diagonalisable. And Sage is failing to report to you the eigenvalues
2+sqrt(2)
and2-sqrt(2)
. It is because of the fact that there are 3 distinct eigenvalues to begin with, that you see that there is a one-dimensional subspace for 2. Please check that the vectors[1, sqrt(2), 1]
and[1, -sqrt(2), 1]
are also eigenvectors.I highly suspect that for whatever reason, Sage is just implementing my matrix as if it was in
QQ
all along while disregarding the input field. I will now update a new bit of experimentation I did in my question.As for what
D
andP
are, I clearly stated that I only got outputs on replacingdiagonalization()
byeigenvalues_right()
. You're right in saying that without that change, you get a value error, which I have reported already in this same post.I will continue to take Sage's word for it, since your matrix is not in fact symmetric. (It would be if you changed the last
-1
to1
, though.) As the documentation foreigenmatrix_right
says, "The matrix P may contain zero columns corresponding to eigenvalues for which the algebraic multiplicity is greater than the geometric multiplicity. In these cases, the matrix is not diagonalizable."