Background
We know we can use expressions like Eigenvalues[m,3]
to get the highest 3 eigenvalues of a matrix and Eigenvalues[m,-2]
to get the lowest 2 eigenvalues. But, the difficulty is MMA uses the magnitude / absolute value of the eigenvalues to rank them. If our lowest (ground state) eigenvalue is say, -1, and there is a many degenerate states with eigenvalues between -1 and 1 and there are many states with eigenvalues greater than 1, then our ground state will be in the "middle" of the list of eigenvalues when they are sorted by magnitude.
Our situation
We want to know the lowest eigenvalue, its multiplicity and its eigenvectors. We assume the eigenvalues are real and MMA can calculate these, but we do not have time for calculate all of the eigenvalues of a large matrix. We also assume the eigenvectors form a "complete orthonormal basis". We want to calculate as few eigenvalues and eigenvectors as possible.
Imagine we calculate the largest and smallest two eigenvalues, call them $\omega_2$ and $\omega_1$ using ω2 = First@Eigenvalues[m, 1]
and ω1 = First@Eigenvalues[m, -1]
. If $\omega_1$ and $\omega_2$ are both zero then all of the eigenvalues are zero. If $\omega_2$ is negative, it is the ground state eigenvalue and we only need to find its multiplicity and eigenvectors. But if $\omega_2$ is positive, then the ground state eigenvalue, $\omega_0$, could have any value such that $-|\omega_1|< \omega_0 < -|\omega_2|$. If $\omega_2$ is positive, $\omega_1$ could also be the ground state eigenvalue, but how can we be sure?
Here is a trick
We can shift all of the eigenvalues up or down by any amount we like. In particular, we can shift them all down by the amount $\omega_2$. We do this by calculating a new matrix m2 = m - ω2 * IdentityMatrix[Length[m]]
If $\omega_2>0$ this shift guarantees the ground state eigenvalue of matrix $m$ can be calculated by ω0 = ω2 + First@Eigenvalues[m2, 1]
. Notice that before we had used -1 to find the smallest (magnitude) eigenvalue. Now we are using +1 to find the most negative eigenvalue.
To understand why this works, we note that the eigenvectors of $m$ are also eigenvectors of the identity matrix.
Multiplicity / Degeneracy
Now that we have the ground state eigenvalue $\omega_0$, how do we find the eigenvectors for that state? We note that the eigenvector(s) corresponding to the ground state eigenvalue $\omega_0$ are a basis for the null space of the matrix $m - \omega_0 I$, where $I$ is the identity matrix. In MMA we can calculate the eigenvectors of the ground state by ev0 = NullSpace[m - ω0 * IdentityMatrix[Length[m]]
. Thanks to @m-bubu for this approach.
Sample code
The following code sample illustrates how we can handle the case when $\omega_2 > 0$ and there is a degenerate ground state $\omega_0 < -|\omega_1|$. In the first section of code we want to create an example matrix that has a degenerate ground state with a negative eigenvalue. We start with a list of eigenvalues, $\omega$ in any order. The list can be any length and can have repeated values. Next, we pick some eigenvectors at random, orthogonalize them and use them to form a matrix $m$. This procedure guarantees $m$ has eigenvalues and eigenvectors with known properties.
ClearAll["Global`*"]
ω = RandomSample[{-1/2, -1/2, 1/2, 3/2, 5/2}];
ndim = Length[ω];
ev = Orthogonalize@RandomInteger[{-2 ndim, 2 ndim}, {ndim, ndim}];
m = Sum[ω[[k]] KroneckerProduct[ev[[k]], ev[[k]]],
{k, 1, ndim}];
m // MatrixForm;
In the second section of code we calculate $\omega_1$ and $\omega_2$. The value of $\omega_1$ is not really used, but it may be of interest to show that $\omega_1$ is not necessarily the ground state eigenvalue.
ω1 = First@Eigenvalues[m, -1];
ω2 = First@Eigenvalues[m, 1];
{ω1, ω2}
(* { 1/2 , 5/2 } *)
In the third section we calculate the matrix $m_2$ and the ground state eigenvalue, $\omega_0$ of the matrix $m$.
m2 = m - ω2 IdentityMatrix[ndim];
ω0 = ω2 + First@Eigenvalues[m2, 1]
(* -1/2 *)
In the final section we calculate the eigenvectors of the ground state as follows:
m3 = m - ω0 IdentityMatrix[ndim];
ev0 = NullSpace[m3];
MatrixForm /@ ev0
This method should efficiently find the ground state eigenvalue and eigenvector(s) for large matrices since it requires calculating only two eigenvalues and then only the eigenvector(s) for the ground state.
Final form
To put the results in the final desired form we would use {k, ω0, ev0}
.
minEigSys[mat_, n_] := With[{eigmax = Abs[Eigenvalues[mat, 1][[1]]]}, With[{esys = Eigensystem[mat - eigmax*IdentityMatrix[Length[mat]], n]}, {esys[[1]] + eigmax, esys[[2]]}]]
$\endgroup$ – Daniel Lichtblau May 21 '17 at 14:49