# Noise in energy spectrum

I am plotting the Landau levels of a system numerically. Every thing is going right except a lot of noise in the energy spectrum. Please, help me out to resolve this issue. Thanks!

c = 3*10^8;
m = (0.09*5.1*10^5)/(c^2);
ℏ = 6.6*10^-16;
v = 4.7*10^5;
Δ = 0.24*10^-3*B;
Subscript[ω, 0] = ℏ*B*m^-1;
Subscript[ω, D] = Sqrt[2*ℏ*B*v^2];
ll = Sqrt[(2*B)/ℏ];

Block[{L = 20, Γ = 1.3*10^-3, λ = 2.5*10^-28, i,
j, one, a, adag, wa, qd, H, Es, list, nn},
one = SparseArray[Band[{1, 1}] -> 1, {L, L}];
a = SparseArray[{j_, i_} /; i - j == 1 -> Sqrt[j], {L, L}];
adag = SparseArray[{j_, i_} /; j - i == 1 -> Sqrt[i], {L, L}];
wa = ll^3*λ*(a . a . a + adag . adag . adag);
qd = Subscript[ω, 0]*(adag . a);
H[B_] =
ArrayFlatten[{{(Δ + 0.5*Subscript[ω, 0])*one +
qd + wa,
I*Subscript[ω, D]*a}, {-I*Subscript[ω, D]*
adag, (-Δ + 0.5*Subscript[ω, 0])*one + qd -
wa}}];
list[B_?NumericQ] := list[B] = Eigenvalues[H[N[B]]];
list[B_?NumericQ, nn_] := list[B][[nn]];
Plot[Evaluate@Transpose@Table[list[B, nn], {nn, 2*L}], {B, 0, 40},
PlotRange -> {{0, 40}, {-0.06, 0.1}}, ImageSize -> 500]
]

• In the way that this is phrased, it does not seem to be a Mathematica question. Perhaps you should consider posing it in a different way!
– bmf
Commented May 30, 2023 at 6:22
• @bbmf I believe it is in as much as it involves sorting the eigenvalues? May be use exclusion zone? Commented May 30, 2023 at 6:38
• @chris all I meant was the simple: "help me translate the noise" or "help me clear our the noise" without a specific mathematics/physics task to be implemented into mathematica seems a question of understanding the background material better and not the software. This is why I said in the way it is phrased, not in its essence
– bmf
Commented May 30, 2023 at 7:13

Add Sort to this line
list[B_?NumericQ] := list[B] = Sort@Eigenvalues[H[N[B]]];

• @chris: If you look carefully, the lines switch color whenever they intersect. This is a side-effect of using Sort and it may or may not be acceptable for the OP. Commented May 30, 2023 at 15:12