# Graphs Plotting Discontinuous

I'm trying to plot a graph from the eigenvalues of a matrix I created. The graph shows with discontinuities in it and I was looking for some feedback.

Here's the code:

v1 = -4.01*Exp[I*(ka)/2];
v2 = -4.01*Exp[-I*(ka)/2];
v3 = -4.01*Exp[I*(ka)];
v4 = -4.01*Exp[-I*(ka)];
Eo = -8.97;

H = {{Eo, v1, 0, 0, 0, v4}, {v2, Eo, v2, 0, v3, 0},
{0, v1, Eo, v4, 0, 0}, {0, 0, v3, Eo, v2, 0}, {0, v4, 0, v1, Eo,
v1}, {v3, 0, 0, 0, v2, Eo}};
MatrixForm[H]
bs = Eigenvalues[H];
Plot[bs, {(ka), -0.8, 0.8}]


I would really appreciate your help.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Commented Nov 6, 2014 at 23:46
• Commented Nov 7, 2014 at 15:26

Small numerical errors generate tiny imaginary parts-Solve it with:

Plot[bs // Chop, {(ka), -0.8, 0.8}]


b[k_?NumericQ] := Eigenvalues[H /. ka -> k];

NB: The Plot[Quiet@Table[...] ...,Evaluated -> True] thing is a dirty trick to force colorization. Perhaps someone could come up with something cleaner.
• But now, all the plots are the same color. Worse, the standard tricks involving Evaluate, With, or the Evaluated option all bring the discontinuities back, as Chop applied to non-numeric expressions just returns the expressions. I was only able to resolve this by generating the data and using ListPlot. Commented Nov 7, 2014 at 13:50
• @MarkMcClure b[k_?NumericQ] := Eigenvalues[H /. ka -> k]; Plot[Quiet@Table[b[ka][[i]], {i, 6}], {(ka), -0.8, 0.8}, Evaluated -> True] Commented Nov 7, 2014 at 14:33
• Much faster, in fact! I actually considered that but didn't try it as I figured it would be very slow as Eigenvalues is evaluated with each and every step. Evidently, the list Root objects take longer to evaluate than Eigenvalues, which might very well be evaluated numerically in this context. Looks worth a +1! Commented Nov 7, 2014 at 14:43