# Solve, store, and access eigenvalues and eigenstates of M[x,y], for various points {x,y}

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?

• 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]] – Roman Jun 11 '19 at 18:37
• Thanks Roman! You solved my problem. ^_^b – Paul Eugenio Jun 12 '19 at 23:44