So my first step was to redefine your functions as such:
ClearAll[A,ε,B,B1,b];
A[α_, c_, b_, q_, ε_][k2_]:=ε + Cos[k2*b + 2*Pi*α]*Exp[-Pi 1/(2*q)]*LaguerreL[c, 0, (Pi*1/q)];
B[a_, q_][k1_]:=Exp[I*k1*q*a];
B1[a_, q_][k1_]:=Exp[-I*k1*q*a];
b[α_, q_][k1_,k2_] :=
SparseArray[{Band[{1, 1}] -> A[α, 0, 1, q, 0][k2],
Band[{1, 2}] -> B[1, q][k1], Band[{2, 1}] -> B1[1, q][k1],
Band[{1, q}] -> B1[1, q][k1], Band[{q, 1}] -> B[1, q][k1]}, {q, q}];
Then I could plot using the following:
Plot3D[Sort[Eigensystem[N[b[1,3][k1,k2]]][[1]]][[2]],{k1,-3,3},{k2,-Pi,Pi},PlotPoints->50]
Which gives:
Similarly,
Plot3D[Sort[Eigenvalues[N[b[1,3][k1,k2]]]][[2]],{k1,-3,3},{k2,-Pi,Pi},PlotPoints->50]
And
Plot3D[Sort[Eigenvalues[b[1,3][k1,k2]]][[2]],{k1,-3,3},{k2,-Pi,Pi},PlotPoints->50]
Both give the same output due to their use of Sort
.
However,
Plot3D[Eigensystem[N[b[1,3][k1,k2]]][[1]][[2]],{k1,-3,3},{k2,-Pi,Pi},PlotPoints->50]
Gives the disconnected & severely noisy plot
And this is due to the lack of use of Sort
. We can also see this same output with:
Plot3D[Eigenvalues[N[b[1,3][k1,k2]]][[2]],{k1,-3,3},{k2,-Pi,Pi},PlotPoints->50]
And
Plot3D[Eigenvalues[b[1,3][k1,k2]][[2]],{k1,-3,3},{k2,-Pi,Pi},PlotPoints->50]
Which both produce the same noisy & mixed eigenvalue plot seen previously.
If this is not what you are looking for, please, let me know? I hope this helps!
After realizing an error in translating OP’s initial codeblock, the following no longer applies:
You might also speed up your matrix assembly by observing that your setting of ε = 0
makes the diagonal go to 0, which could prevent the need to do such extraneous computations when assembling runs of your matrices.
Tl;dr: Using Sort
is key to helping eliminate the noise that was present.
MaxRecursion
to smooth the plot. For example,Plot3D[Eigenvalues[b[1, 3]][[2]], {k1, -3, 3}, {k2, -\[Pi], \[Pi]}, MaxRecursion -> 6]
. You could also increase the number ofPlotPoints
. $\endgroup$Eigensystem
? I find it is much more convenient. How large are your matrices? I calculate 1000x1000 and larger often in seconds or less. $\endgroup$