# Problems with plotting the imaginary part of an eigenvalue

f[k_] = {{0.001 - 2 I k + 0.001 k^2, -0.001, 0.001, -0.001}, {-1,
0.5 - I k + 0.001 k^2, 0.501, -0.001}, {0.001, -0.001,
0.001 + 2 I k + 0.001 k^2, -0.001}, {0.501, -0.001, -1,
0.5 + I k + 0.001 k^2}};

r[k_] = Eigenvalues[f[k]][[3]];

Plot[Re[r[k]], {k, -1, 1}]
Plot[Im[r[k]], {k, -1, 1}]


What is wrong with the imaginary part? Thanks!

• If we sort the eigenvalues according to the imaginary parts then we get a mix up of eigenvalues... because it is not the case that the $Im$ part of the 3rd eigenvalue is the largest, e.g. for negative $k$ it is smaller than the $Im$ part of the other eigenvalues. – user149901 Sep 19 '14 at 15:51

f[k_] = Rationalize@{{0.001 - 2 I k + 0.001 k^2, -0.001,
0.001, -0.001}, {-1, 0.5 - I k + 0.001 k^2, 0.501, -0.001}, {0.001, -0.001,
0.001 + 2 I k + 0.001 k^2, -0.001}, {0.501, -0.001, -1, 0.5 + I k + 0.001 k^2}};
r[k_] = Eigenvalues[f[k], Cubics -> True, Quartics -> True][[3]];
p1 = Plot[Im[r[k]], {k, -1, 1}, WorkingPrecision -> 30, Exclusions -> None]


• Yes, I would answer the same way. Maybe you can add that k=0 is a point of degeneracy, which causes the kink in the plot: the eigenvalue is not required to follow a differentiable curve through such a point. However, you could define the "correct" plot by switching between eigenvectors 3 and 4 at k=0. – Jens Sep 19 '14 at 16:39
• Thanks for the answer, but I think we still get a mix up of two imaginary parts: the value $Im[r[0.5]]$ with $r$ defined as in my question is $0.501299$ and not with a negative sign. So is this a concatenation of two eigenvalues? Thanks. – user149901 Sep 19 '14 at 23:23
• Can we get the same picture only the line for positive $k$ replaced by its reflection w.r.t the horizontal line? – user149901 Sep 19 '14 at 23:48

Just use Chop to get rid of small and spurious quantities:

f[k_] = {{0.001 - 2 I k + 0.001 k^2, -0.001, 0.001, -0.001}, {-1,
0.5 - I k + 0.001 k^2, 0.501, -0.001}, {0.001, -0.001,
0.001 + 2 I k + 0.001 k^2, -0.001}, {0.501, -0.001, -1,
0.5 + I k + 0.001 k^2}};

r[k_] = Eigenvalues[f[k]][[3]] // Chop;

Plot[{Re[r[k]],Im[r[k]]}, {k, -1, 1}]
(* 140919_Plot_Re_Im_Eigenvalues.jpg *)


Remark off topic: the "fine structure" of Re[r] can be revealed easily by chosing a PlotRange->{0.48,0.52}

Regards, Wolfgang

Replace the second line by

r[k_] := -I Sort[I Eigenvalues[f[k]]][[3]];


And life is good.