Ask Your Question
0

Diagonalisability check Malfunctioning [closed]

asked 2023-08-31 03:45:54 +0100

yeetcode gravatar image

updated 2023-09-01 00:19:21 +0100

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.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by yeetcode
close date 2023-09-01 00:18:24.590088

Comments

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.

John Palmieri gravatar imageJohn Palmieri ( 2023-08-31 04:14:03 +0100 )edit

In the last paragraph, what do you mean by D and P? They can't have been the values returned by A.diagonalization(), since that fails.

John Palmieri gravatar imageJohn Palmieri ( 2023-08-31 04:14:36 +0100 )edit

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) and 2-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.

yeetcode gravatar imageyeetcode ( 2023-08-31 09:07:20 +0100 )edit

As for what D and P are, I clearly stated that I only got outputs on replacing diagonalization() by eigenvalues_right(). You're right in saying that without that change, you get a value error, which I have reported already in this same post.

yeetcode gravatar imageyeetcode ( 2023-08-31 09:11:50 +0100 )edit
1

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 to 1, though.) As the documentation for eigenmatrix_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."

John Palmieri gravatar imageJohn Palmieri ( 2023-08-31 17:21:07 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-08-31 12:50:40 +0100

JTS gravatar image

Your matrix is not symmetric:

A = matrix(QQbar, [[2,-1,0],[-1,2,1],[0,-1,2]])
A.is_symmetric()
edit flag offensive delete link more

Comments

My bad. I wished to work with A[1,2] = -1 instead. There are still issues, but nothing like whatever I wrote here. Thanks to you and John for this!

yeetcode gravatar imageyeetcode ( 2023-09-01 00:17:42 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2023-08-31 03:45:54 +0100

Seen: 172 times

Last updated: Sep 01 '23