Created
May 3, 2015 19:43
-
-
Save wangleiphy/b7346ebe3cd877b1cb49 to your computer and use it in GitHub Desktop.
This file contains 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
#here we generate a Ham and simulate the weight to see if they are negative | |
from numpy import array, bmat, zeros , dot , diag , eye, ones , sort , prod | |
from numpy.random import rand | |
from scipy.linalg import det , expm, eig , logm | |
import numpy as np | |
np.set_printoptions(suppress=True, precision=2, linewidth=100) | |
def build_Ham(n): | |
B = (rand(n/2, n/2)-0.5)*4. | |
Ham = bmat([[zeros((n/2,n/2),float), B], [B.transpose(), zeros((n/2,n/2),float)]]) | |
return Ham | |
Ns = 6 #size of the A matrix | |
N = 4 #number of the A matrices | |
for itry in range(1): | |
tmp = expm(build_Ham(Ns)) | |
for i in range(N): | |
tmp = dot( expm(build_Ham(Ns)) , tmp) | |
res = eye(Ns) + tmp | |
print "det(1+e^{A}...e^{A}): ", det(res) #>=0 according to the conjecture | |
M = logm(tmp) | |
print "M = log(e^{A}...e^{A}):\n", M | |
w, v = eig(M) | |
print "eig(M): ", w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment