0
$\begingroup$

I am trying to calculate eigensystems for a matrix Ap, which I have provided an example of which in this thread. The matrix in general has a dependency on a variable a and its read

Ap[a_, kx_, ky_] := {0.5 a u1[kx, ky] + 3 kx u2[kx, ky] + 3 ky u2[kx, ky] + D[u2[kx, ky], kx], 2 kx u1[kx, ky] + 2 ky u1[kx, ky] - D[u1[kx, ky], kx] - 0.3 a kx u2[kx, ky]}

I then called

     {vals, vecs} = NDEigensystem[ Ap[1, kx, ky], {u1[kx, ky], u2[kx, ky]}, {kx, -3, 3}, {ky, -3, 3}, 10, Method -> {"SpatialDiscretization" -> {"FiniteElement",  {"MeshOptions" -> {MaxCellMeasure -> 0.01}}}}]; 

In addition, I have tried to incorporate the insertion of variable a in the matrix using the suggestion here as

p[a_, n_] := 
 Block[{aval = a, nmax = n}, {vals, vecs} = 
    NDEigensystem[
     Ap[aval, kx, ky], {u1[kx, ky], u2[kx, ky]}, {kx, -3, 3}, {ky, -3,
       3}, nmax, 
     Method -> {"SpatialDiscretization" -> {"FiniteElement", \
{"MeshOptions" -> {MaxCellMeasure -> 0.01}}}}];
   Table[
    Plot3D[vecs[[i]], {kx, -3, 3}, {ky, -3, 3}, PlotRange -> All, 
     Mesh -> None, PlotLabel -> vals[[i]], ColorFunction -> "Rainbow",
      AxesLabel -> {"kx", "ky", ""}], {i, 1, nmax}]
   ]
  p[1.0, 10]

Is there a possibility to generate vals[a,kx,ky]?

$\endgroup$
2
  • $\begingroup$ Try to Quit the kernel and try again. Your first example give a different error message for me. $\endgroup$
    – user21
    Commented Jan 25, 2023 at 13:06
  • $\begingroup$ You are right. The error disappeared after restarting the kernel. I have edited the question accordingly. Do you have any suggestions on getting two functions, vals[a,kx,ky] and vecs[a,kx,ky]? Based on my attempt above, I can get vals but don't have access to the k variables yet. $\endgroup$
    – Shasa
    Commented Jan 25, 2023 at 13:37

0

Your Answer

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