4
$\begingroup$

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!

enter image description here

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]
 ]
$\endgroup$
3
  • $\begingroup$ 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! $\endgroup$
    – bmf
    Commented May 30, 2023 at 6:22
  • $\begingroup$ @bbmf I believe it is in as much as it involves sorting the eigenvalues? May be use exclusion zone? $\endgroup$
    – chris
    Commented May 30, 2023 at 6:38
  • $\begingroup$ @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 $\endgroup$
    – bmf
    Commented May 30, 2023 at 7:13

1 Answer 1

7
$\begingroup$

As suggested by @chris, the vertical lines are caused by the order of spectra.

Add Sort to this line

list[B_?NumericQ] := list[B] = Sort@Eigenvalues[H[N[B]]];

enter image description here

$\endgroup$
13
  • $\begingroup$ Note that the green blue and yellow line switch near (20,0). $\endgroup$
    – chris
    Commented May 30, 2023 at 9:46
  • 3
    $\begingroup$ @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. $\endgroup$ Commented May 30, 2023 at 15:12
  • $\begingroup$ (Though I have no idea how one would go about creating a "clean" plot in which they didn't swap like this) $\endgroup$ Commented May 30, 2023 at 15:20
  • $\begingroup$ Thanks for removing the noise. But the lines which are crossing are not straight. Could you please help me to resolve it. $\endgroup$
    – user199
    Commented May 30, 2023 at 17:02
  • $\begingroup$ @MichaelSeifert I don't think it makes sense to talk about which eigenvalue belongs to which curve. Maybe we can try to keep the first derivative of the curve to be continuous, but there can also be cases the first derivatives of two curves are equal, or there can be singularities. $\endgroup$
    – Lacia
    Commented May 30, 2023 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.