Bug introduced in 8.0 or earlier and persisting through 11.3
According to the documentation,
Eigenvalues[m,k]
gives the firstk
eigenvalues ofm
...If they are numeric, eigenvalues are sorted in order of decreasing absolute value ...
Eigenvalues[m,-k]
gives the k that are smallest in absolute value."
What is the output of Eigenvalues[m,-k]
if one specifies a method?
For example, consider
SeedRandom[1122];
mat = (# + Transpose[#]) &[RandomReal[{-1, 1}, {4, 4}]];
Eigenvalues[mat]
(* {-2.35168, 2.30789, 1.26678, -0.48013} *)
Eigenvalues[mat, 2, Method -> {"Arnoldi"}]
(* {-2.35168, 2.30789} *)
Eigenvalues[mat, -2, Method -> {"Arnoldi"}]
(* {1.26678, -0.48013} *)
This is exactly what I'd expect: the first two and last two eigenvalues, respectively, sorted in descending order by absolute value as usual. But now consider
Eigenvalues[mat, 2, Method -> {"Arnoldi", "Criteria" -> "RealPart"}]
(* {2.30789, 1.26678} *)
Eigenvalues[mat, -2, Method -> {"Arnoldi", "Criteria" -> "RealPart"}]
(* {2.30789, 1.26678} *)
Why are the "first two" and "last two" eigenvalues the same? I would have expected the last line to return {-0.48013, -2.35168}
- the last two eigenvalues sorted in descending order by real part.
(Mathematica v 11.0.1.0 on Mac OS X Yosemite v 10.10.5.)
Eigenvalues[m,spec]
is always equivalent toTake[Eigenvalues[m],spec]
." I suggest letting Wolfram Support know about this. Please let us know what they said. $\endgroup$SeedRandom
at the beginning with a seed that results in the unexpected output. $\endgroup$Method
. (AttemptingTake[Eigenvalues[mat, Method -> {"Arnoldi", "Criteria" -> "RealPart"}], -2]
returnsEigenvalues::arall: Method -> Arnoldi cannot be used to compute more than 2 out of the 4 eigenvalues and/or eigenvectors.
) $\endgroup$-k
seems to return thek
smallest positive eigenvalues. BTW I also use M11.0.1 on OS X 10.12.1. $\endgroup$