1
$\begingroup$

I'm interested in solving a position dependent eigenvalue problem for matrix M[x,y], where {x,y} is some discretized set of points. I may need to access the eigenstates and eigenvalues multiple times throughout the code, so calculating and storing the necessary information at essential points ahead of time, such that it can be accessed later, would be ideal.

For example, I would like a function Eig[kx,ky] which returns the stored list of eigenvalues at point {kx,ky}.

Is there a straightforward way of doing this in Mathematica?

$\endgroup$
  • 3
    $\begingroup$ There is no need to pre-calculate, you can use memoization: see this tutorial. Something like Eig[x_?NumericQ, y_?NumericQ] := Eig[x, y] = Eigensystem[M[x, y]] $\endgroup$ – Roman Jun 11 '19 at 18:37
  • $\begingroup$ Thanks Roman! You solved my problem. ^_^b $\endgroup$ – Paul Eugenio Jun 12 '19 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.