# Noise in Eigenvalues plot

I am trying to Plot Eigenvalues of a Hamiltonian, but I am getting noisy plot, which is incorrect. Here is the code.

A1 = {{0, 1, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, -1}, {0, 0, -1, 0}};
A2 = {{0, -I, 0, 0}, {I, 0, 0, 0}, {0, 0, 0, -I}, {0, 0, I, 0}};
A3 = {{0, 0, 0, -1}, {0, 0, 1, 0}, {0, 1, 0, 0}, {-1, 0, 0, 0}};
A4 = {{0, -I, 0, 0}, {I, 0, 0, 0}, {0, 0, 0, I}, {0, 0, -I, 0}};
A5 = {{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, -1}};
A6 = {{0, 0, 0, -I}, {0, 0, I, 0}, {0, -I, 0, 0}, {I, 0, 0, 0}};
A7 = {{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}};
A8 = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, -1}};
H[d_, λ_, β_, m_] :=
a (Sin[x] A1 + Sin[ky] A2) + A3 β +
d A4 + (t Cos[z] + 2 b (2 - Cos[x] - Cos[ky])) A5 + α*
Sin[ky] A6 + λ Sin[z] A7+m*A8;
ky = 0;
a = 1;
b = 1;
t = 1.5;
α = 0.3;
Plot3D[Eigenvalues[H[0.1, 0.5, 0.7, 0]][[4]], {x, -π, π}, {z, 0, 2 π}]


Any help will be highly appreciated.

By default, the eigenvalues are ordered by absolute value. All the eigenvalues of this particular matrix have the same absolute value plus some rounding errors. Thus, it can easily happen, that the fourth eigenvalue is positive or negative, depending on the parameters.

You can use Max to plot the largest eigenvalue:

Plot3D[Max@Eigenvalues[H[0.1, 0.5, 0.7, 0.]], {x, -Pi, Pi}, {z, 0, 2 Pi}]


Alternatively, you may use the "Criteria" suboption of the Method "Arnoldi":

Plot3D[
Eigenvalues[
H[0.1, 0.5, 0.7, 0], -1,
Method -> {"Arnoldi", "Criteria" -> "RealPart"}
],
{x, - Pi, Pi}, {z, 0, 2 Pi}]

• Thanks @ Henrik Schumacher – Hazoor Imran Apr 21 at 22:17
• You're welcome. – Henrik Schumacher Apr 21 at 22:40

Not sure why you pick the 4th element, but maybe this will help:

ev4 = Eigenvalues[H[p, q, r, s]][[4]] /.
Thread[{p, q, r, s} -> {0.1, 0.5, 0.7, 0}];
Plot3D[ev4, {x, -π, π}, {z, 0, 2 π}]


• Thanks @ Michael E2, Is it possible to do this with an equation by the contourplot. Like ev4 = Eigenvalues[H[p, q, r, s]][[4]] /. Thread[{p, q, r, s} -> {0.1, 0.5, 0.7, 0}]; ContourPlot[ev4==-0.5, {x, -[Pi], [Pi]}, {z, 0, 2 [Pi]}]. In my case this is not working. – Hazoor Imran Apr 21 at 22:01
• @HazoorImran Yes, but set the value -0.5 on the right hand side to something bigger. For example ContourPlot[ev4 == 2, {x, -\[Pi], \[Pi]}, {z, 0, 2 \[Pi]}]. – Michael E2 Apr 21 at 22:09
• Thanks @ Michael E2, Yes this work. – Hazoor Imran Apr 21 at 22:16