Define functions and classes
In [1]:
%matplotlib inline
import sys
sys.path.insert(0, '../../module')
import neuosc as ns
import numpy as np
import scipy as sp
from scipy.linalg import expm
import matplotlib.pyplot as plt
In [3]:
reload(ns)
Out[3]:
In [244]:
thetav = 0.537#*sp.pi/180
fraction = 2
lambda0 = np.cos(2*thetav)/fraction
alpha = 0.1
omegam = np.sqrt(lambda0**2+1-2*lambda0*np.cos(2*thetav))
beta_r = 1-1/fraction
In [245]:
def lambda1(beta,x):
"""perturbation of matter"""
return alpha*lambda0*np.sin(beta*x);
In [246]:
def hamil(beta,x):
""""Hamiltonian of the system with perturbation"""
return (-omegam/2 + (lambda1(beta,x)/2 )*((np.cos(2*thetav)-lambda0)/(omegam)) )*ns.pauli_matrices(3) + (lambda1(beta,x)/2) * (np.sin(2*thetav) /omegam)*ns.pauli_matrices(1)
In [247]:
def sliced_evo(beta,x,deltax):
return expm(-1j*hamil(beta,x)*deltax)
Calculate the evolution matrix at anytime
In [248]:
def evo(beta,x,deltax):
evo_mat = np.array([[1,0],[0,1]])
for xi in np.linspace(0, x, np.floor(x/deltax)):
evo_mat = np.dot(sliced_evo(beta,xi,deltax), evo_mat)
return evo_mat
In [249]:
def evo_00(beta,x,deltax):
evo_mat = np.array([[1,0],[0,1]])
evo_00_list = np.array([])
for xi in np.linspace(0, x, np.floor(x/deltax)):
evo_mat = np.dot(sliced_evo(beta,xi,deltax), evo_mat)
evo_00_list = np.append(evo_00_list, np.absolute(evo_mat[0,0])**2)
#print xi
#print np.absolute(evo_mat[0,0])**2
#print ""
return evo_00_list
In [279]:
np.absolute(sliced_evo(beta_r*(1-0.09),1,1)[0,0])**2
Out[279]:
In [278]:
print np.absolute(1+0.5j), norm(1+0.5j)
In [292]:
endtemp = 10000
step = 1
sliced_evo_lt = np.ones(endtemp)
for temp in range(0,endtemp):
sliced_evo_lt[temp] = np.absolute(sliced_evo(beta_r*(1-0.09),temp,step)[0,0])**2
# print np.absolute(sliced_evo(beta_r*(1-0.09),temp,step)[0,0])**2
plt.figure(figsize=(10,10))
plt.plot(sliced_evo_lt)
Out[292]:
In [298]:
endtemp = 100
step = 1
sliced_evo_lt = np.ones(endtemp)
for temp in range(0,endtemp):
sliced_evo_lt[temp] = np.real(hamil(beta_r*(1-0.09),temp)[0,1])
plt.figure(figsize=(10,10))
plt.plot(sliced_evo_lt)
Out[298]:
In [ ]:
In [261]:
plt.figure(figsize=(10,10))
plt.plot(evo_00(beta_r*(1-0.1),10000,1))
plt.ylabel("1,1 element")
Out[261]:
In [264]:
plt.figure(figsize=(10,10))
plt.plot(evo_00(beta_r*(1-0.09),1000,0.1))
plt.ylabel("1,1 element")
Out[264]:
In [252]:
ns.pauli_matrices(1.0)
Out[252]:
In [253]:
np.append(np.array(ns.pauli_matrices(1)),np.array(ns.pauli_matrices(2)),axis=0)
Out[253]:
In [254]:
def evo_01(beta,x,deltax):
evo_mat = np.array([[1,0],[0,1]])
evo_01_list = np.array([])
for xi in np.linspace(0, x, np.floor(x/deltax)):
evo_mat = np.dot(sliced_evo(beta,xi,deltax), evo_mat)
evo_01_list = np.append(evo_01_list, np.absolute(evo_mat[0,1])**2)
#print xi
#print np.absolute(evo_mat[0,0])**2
#print ""
return evo_01_list
In [255]:
plt.figure(figsize=(10,10))
plt.plot(evo_01(beta_r,10000,1))
plt.ylabel("1,2 element")
Out[255]:
In [256]:
np.dot(evo(beta_r,5000,1),np.array([1,0]))
Out[256]:
In [257]:
evo(beta_r,5000,1)
Out[257]:
In [258]:
hamil(beta_r,1)
Out[258]:
In [ ]: