8
$\begingroup$

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

$\endgroup$
9
  • 1
    $\begingroup$ 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. $\endgroup$
    – Szabolcs
    Commented Nov 2, 2016 at 10:22
  • 1
    $\begingroup$ Can you make the example reproducible? Put in a SeedRandom at the beginning with a seed that results in the unexpected output. $\endgroup$
    – Szabolcs
    Commented Nov 2, 2016 at 10:24
  • 2
    $\begingroup$ @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.) $\endgroup$
    – tparker
    Commented Nov 2, 2016 at 20:50
  • 1
    $\begingroup$ Maybe add your exact M version and OS as well, just in case. $\endgroup$
    – Szabolcs
    Commented Nov 2, 2016 at 20:59
  • 1
    $\begingroup$ 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. $\endgroup$
    – Szabolcs
    Commented Nov 2, 2016 at 21:53

2 Answers 2

4
$\begingroup$

Wolfram Tech Support has confirmed that this is a bug and will work on fixing it.

$\endgroup$
4
$\begingroup$

Probably the "Shift" option is not being properly set for the given "Criteria". Since we know that the largest eigenvalue by magnitude is 2.35168, we can assume that the smallest possible eigenvalue by real part will have a real part no smaller than -2.35168. So, using this as an approximate shift gives:

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

{-2.35168, -0.48013}

as desired.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.