# MATLAB: anti-crossing eigenvalues

1. Feb 23, 2012

### phy127

I am solving an eigenvalue problem -- Hamiltonian problem in Quantum Mechanics. The matrix is 8x8 with off-diagonal terms, but some are zero.

It is well known that the eigenvalues of a Hermitian matrix anti-cross as it nears each other. This is very easy see if the matrix have an independent variable.

However, if the matrix have some zero off-diagonal elements, the anti-crossing is lost and some eigenvalues could cross. Then, the problem arises.

Correct me if I'm wrong. When a matrix is diagonalized, matlab sorted the eigenvalues. Now, if there is anti-crossing, I have no problem since the initial sorting of eigenvalues will not change as I vary my variable.

If there are eigenvalues that crosses each other, then at the instant there is crossing, the sorting of eigenvalues will be different. Please have a look at my attached image. Look at the yellow and purple lines, at their crossing, the initial sorting of eigenvalues is broken.

QUESTION:
Is there any way such that the initial sorting of eigenvalues, e.g. when my variable is zero, will not change as I vary my variable?
Back in my mind, it should be possible if during the sorting of eigenvalues, in each step, it will consider the previous eigenvalues. The changes are small anyway. But I don't know exactly how to implement it.