# Eigenvalues of matrix not giving imaginary parts

This might be a very simple problem, but I can't seem to figure out why I am getting this. I am trying to find the eigenvalues of the matrix:

{{3.9999999999998025*^14 + 0.001*I, 3.141592653589793 -3.1405926535897932*I},
{3.141592653589793 - 3.1405926535897932*I, 3.9999999999998025*^14 + 0.001*I}}


but when I call the Eigenvalues function on it, I only get the real parts.

I did it on Wolfram Alpha and got the imaginary parts and real parts. Also, if I change the *10^14 to *10^13, the eigenvalues have an imaginary part.

I'm guessing it's some kind of precision problem, but I'm not sure how to resolve this. Any ideas?

You are correct to say that this is a problem with the precision of the numbers involved. You can set the precision of those numbers explicitly:

SetPrecision[{{3.9999999999998025*^14 + 0.001*I,
3.141592653589793 - 3.1405926535897932*I},
{3.141592653589793 - 3.1405926535897932*I,
3.9999999999998025*^14 + 0.001*I}},
20];

Eigenvalues[%]

(* Out: {3.9999999999998339159*10^14 - 3.1395926535897932261 I,
3.9999999999997710841*10^14 + 3.1415926535897932262 I} *)


It may not be relevant to your application, but you might want to consider specifying those values as infinite-precision values. For instance, instead of writing 3.141592... you could use Pi, instead of 0.001 you could use 1/1000, etc.

• Great, thank you! And thanks for editing the post, much more readable now. – Alex Jun 8 '15 at 18:52
• Yeah, I understand this would be better, but the matrix was not written from scratch. It was computed which resulted in a loss of precision. – Alex Jun 8 '15 at 18:54
• @Alex I see; as I said, that may very well not apply to your case. Maybe there could be a way to compute the matrix symbolically from the very start, but of course you know your application better than I do. – MarcoB Jun 8 '15 at 18:57