In [3]:
import numpy as np
import matplotlib as mpl
import matplotlib.pylab as plt
import qutip as qt
import seaborn as sns
%matplotlib inline
sns.set()
sns.set_context('poster')
sns.set_style('ticks')
In [315]:
def gauss_state(x,x0,sigma):
return np.power((2*np.pi*sigma**2),-1/4)*np.exp(-1*np.power(x-x0,2)/(4*sigma**2))
def polProbs(sx,sy,sxp,syp,psi0,theta):
result = 0
basis = [qt.Qobj([[1],[0]]).unit(), qt.Qobj([[0],[1]]).unit()]
for v in basis:
result += ((v.dag()*theta)*(theta.dag()*sy)*(sy.dag()*sx)*(sx.dag()*psi0)\
*(psi0.dag()*sxp)*(sxp.dag()*syp)*(syp.dag()*v)).norm()
return result
def two_gauss(x,x0,x1,sigma):
return np.power((2*np.pi*sigma**2),-1/2)*np.exp(-1*np.power(x-x0,2)/(4*sigma**2)-1*np.power(x-x1,2)/(4*sigma**2))
def prob_n(n,psi0,eps,step,0,xspace,yspace,sigma,theta):
sigmas_x = [qt.Qobj([[1],[1]]).unit(), qt.Qobj([[1],[-1]]).unit()]
eig_s = [1,-1]
sigmas_y = [qt.Qobj([[1],[1j]]).unit(), qt.Qobj([[1],[-1j]]).unit()]
z = 0
x = 0
y = 0
for (sx,esx) in zip(sigmas_x,eig_s):
for (sxp,esxp) in zip(sigmas_x,eig_s):
for (sy,esyp) in zip(sigmas_y,eig_s):
for (syp,esyp) in zip(sigmas_y,eig_s):
prob_amp = polProbs(sx,sy,sxp,syp,psi0,theta)
xvals = prob_amp*two_gauss(xspace,n*(eps*esx)+step*d0,n*(eps*esxp)+step*d0,sigma)
yvals = two_gauss(xspace,n*(d0),n*(d0),sigma)
#yvals = two_gauss(yspace,n*(eps*esy+d0),n*(eps*esyp+d0),sigma)
x += xvals
y += yvals
return np.outer(x,x),x,y
In [334]:
sigma = 4
eps = 0.005*sigma
d0 = 5*sigma
xspace = np.arange(-10*sigma, 10*sigma, 0.25)
yspace = np.arange(-10*sigma, 10*sigma, 0.25)
psi0 = qt.Qobj([[1],[1j]]).unit()
t = np.pi*.8
theta = qt.Qobj([[np.cos(t)],[np.sin(t)]]).unit()
print(theta)
steps = [0,10,100,200,300,400,500,600]
(z,x,y)= prob_n(500,psi0,eps,d0,xspace,yspace,sigma,theta)
plt.imshow(z,origin="lower",extent=[-10*sigma,10*sigma,-10*sigma,10*sigma],cmap=mpl.cm.afmhot)
#plt.plot(xspace,x)
#plt.plot(yspace,y)
#plt.xlim(-40,40)
Out[334]:
In [183]:
sigmas_x = [qt.Qobj([[1],[1]]).unit(), qt.Qobj([[1],[-1]]).unit()]
sigmas_y = [qt.Qobj([[1],[1j]]).unit(), qt.Qobj([[1],[-1j]]).unit()]
eig_s = [1,-1]
psi0 = qt.Qobj([[0],[1]]).unit()
for (sx,esx) in zip(sigmas_x,eig_s):
for (sxp,esxp) in zip(sigmas_x,eig_s):
for (sy,esyp) in zip(sigmas_y,eig_s):
for (syp,esyp) in zip(sigmas_y,eig_s):
print(polProbs(sx,sy,sxp,syp,psi0))
In [80]:
type(q)
Out[80]:
In [ ]: