MWE:
Block[{dim = 4, grain = 250, matrix, domain, spectrum, locus},
matrix = DiagonalMatrix[Table[Sqrt[(x + 1/2 - (1 + Exp[-(i - 1)])^(-1))^2 +
(y (1 + Exp[-2 (i - 1)])^(-1))^2], {i, 1, dim}]];
domain = Flatten[Table[{x, y}, {x, -1, 1, 2./(grain - 1)}, {y, -1, 1,2./(grain - 1)}], 1];
spectrum = Table[Append[σ, Sort@Re@Eigenvalues[ReplaceAll[matrix, {x -> σ[[1]],
y -> σ[[2]]}]]], {σ, domain}];
locus[energy_] := Table[Join[spectrum[[σ, 1 ;;2]], Take[SortBy[spectrum[[σ, 3]],
Abs[# - energy] &],1]], {σ, 1, Length@domain}];
ListContourPlot[locus[0.1], Contours -> {0.1}, InterpolationOrder -> 4] /.
_Polygon -> Sequence[]
]
This code block functions roughly as desired, but the quality of the plot is very bad and cannot be satisfactorily improved by increasing grain
and InterpolationOrder
. Clearly, in this example matrix, the contours should be smooth ellipses and we need to recover that to a higher fidelity.
The matrix
here is a toy, the only real constraint on the matrix I need to preserve is that it must be Hermitian and depend on two independent, real variables.
My solution attempt:
- discretizes the
domain
into a mesh of (x,y) points - collects into array
spectrum
adim
-dimensional eigenvalue-list (of real numbers) at every point in thedomain
- Defines a function
locus
which reduces thespectrum
array to include only a single eigenvalue (rather thandim
-many) at every point in thedomain
. - Perform a
ListContourPlot
of thelocus
However, I believe that the Take
of the "correct" eigenvalue in step 3 eigenvalue at every point in the domain is likely the source of the problem.
In my MWE, I Take
the eigenvalue which is absolutely nearest to the function argument energy
. However, I can envision several pathological function landscapes which break this selection and, indeed, the plots illustrate this problem.
The goal of the code is to plot a level set (contour) of all points where there is any eigenvalue of the matrix