Lowest Magnitude Eigenvalues of Large Sparse Matrices
Use the Arnoldi method with shift-inversion:
Eigenvalues[A, 3, Method -> {"Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0}]
gives you the three smallest eigenvalues by absolute value (by magnitude). See here: Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1
After comments by @HenrikSchumacher it appears that the same can be achieved with
Eigenvalues[A, -3, Method -> {"Arnoldi", "Criteria" -> "Magnitude"}]
and there is no need for explicit shift-inversion.
And as @CarlWoll points out, this method is the default method for sparse matrices, so even
Eigenvalues[A, -3]
achieves the same effect. For non-sparse matrices, however, specifying the method can give a large speedup.
update
It now looks like you want the eigenvalues with smallest real part, not those with smallest magnitude. This you can also achieve with the Arnoldi method:
Eigenvalues[M, 3, Method -> {"Arnoldi", "Criteria" -> "RealPart"}]
gives the three eigenvalues with largest real part. To get the smallest ones, do
-Eigenvalues[-M, 3, Method -> {"Arnoldi", "Criteria" -> "RealPart"}]
The trick is that M
and -M
have the same eigenvalues (up to sign) and eigenvectors.
Of course this trick also works with the other methods presented above.
To calculate the lowest eigenvalues using Mathematica, I always introduce a "shift" in the following way:
mat1 = mat - IdentityMatrix[Length[mat]]*large
and then add large
to the result of Eigenvalues[mat1]
. This operation leaves
the eigenvectors unchanged and I do not need to use Arnoldi specifically. Of course,
Arnoldi does a similar shift inside, however I am not sure if that is used correctly in the Mathematica implementation.
Example:
mat={{1.,2.},{3.,4.}};
The eigenvalues are in the order given by Eigenvalues
{5.37228, -0.372281}.
The procedure above produces for any large enough large
:
{-0.372281, 5.37228}
with the smallest first. Or Eigenvalues[mat1,1]+large
just the lowest eigenvalue.