# Calculating smallest eigenvalues by real part using Arnoldi method

Bug introduced in 8.0 or earlier and persisting through 11.3

According to the documentation,

Eigenvalues[m,k] gives the first k eigenvalues of m ...

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

• This does seem to directly contradict the documentation ... "Eigenvalues[m,spec] is always equivalent to Take[Eigenvalues[m],spec]." I suggest letting Wolfram Support know about this. Please let us know what they said. – Szabolcs Nov 2 '16 at 10:22
• Can you make the example reproducible? Put in a SeedRandom at the beginning with a seed that results in the unexpected output. – Szabolcs Nov 2 '16 at 10:24
• @Szabolcs This error occurs regardless of the choice of random seed. Also, this isn't exactly contradicting the documentation, because the statement you quoted does not apply to the case where one specifies a Method. (Attempting Take[Eigenvalues[mat, Method -> {"Arnoldi", "Criteria" -> "RealPart"}], -2] returns Eigenvalues::arall: Method -> Arnoldi cannot be used to compute more than 2 out of the 4 eigenvalues and/or eigenvectors.) – tparker Nov 2 '16 at 20:50
• Maybe add your exact M version and OS as well, just in case. – Szabolcs Nov 2 '16 at 20:59
• I'm sorry, I'm not sure what I did exactly when I tried this, but if I copy your code now, as you wrote it, I do get identical results for 2 and -2. It appears that "smallest" is taken to be "smallest positive" for some reason. Try bigger matrices or using -1 instead of -2. -k seems to return the k smallest positive eigenvalues. BTW I also use M11.0.1 on OS X 10.12.1. – Szabolcs Nov 2 '16 at 21:53

Eigenvalues[mat, -2, Method -> {"Arnoldi", "Criteria"->"RealPart", "Shift"->-2.5}]