Created
September 29, 2023 02:02
-
-
Save dela3499/310a2e14fe57e6a1ec61c5b6608e6631 to your computer and use it in GitHub Desktop.
Beautiful Eigenvalue Cloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import itertools | |
%matplotlib inline | |
lim = 20 | |
n_points = 100000 | |
t1 = np.linspace(-lim, lim, int(np.sqrt(n_points))) | |
t2 = np.linspace(-lim, lim, int(np.sqrt(n_points))) | |
all_eigenvalues = [] | |
for (t1i, t2i) in itertools.product(t1,t2): | |
raw = """ | |
-i -i i 0 -i 0 -i; | |
-i 0 .3 -i 0 0 -i; | |
0 -i 0 .3 i .3 i; | |
0 -i i -i i .3 -i; | |
0 i i 0 0 -i i; | |
0 .3 0 -i 0 {t1} 0; | |
-i {t2} i i i .3 -i | |
""".format(t1 = t1i, t2 = t2i).replace("i","1j") | |
matrix = np.mat(raw) | |
eigenvalues, _ = np.linalg.eig(matrix) | |
all_eigenvalues.append(eigenvalues) | |
final_eigenvalues = np.concatenate(all_eigenvalues) | |
plt.figure(figsize = (20,20)) | |
plt.scatter( | |
final_eigenvalues.real, | |
final_eigenvalues.imag, | |
marker = '.', color = 'k', alpha = 0.05, s=1) | |
plt.axes().set_aspect('equal') | |
plt.xlim([-3,3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment