In [10]:
import matplotlib.pyplot as plt
from numpy import sqrt,pi,cos,sin,arange,random
from qutip import *
In [2]:
H = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/sqrt(2)],[1/sqrt(2)]])
M45 = Qobj([[1/sqrt(2)],[-1/sqrt(2)]])
R = Qobj([[1/sqrt(2)],[-1j/sqrt(2)]])
L = Qobj([[1/sqrt(2)],[1j/sqrt(2)]])
In [3]:
def sim_transform(o_basis1, o_basis2, n_basis1, n_basis2):
a = n_basis1.dag()*o_basis1
b = n_basis1.dag()*o_basis2
c = n_basis2.dag()*o_basis1
d = n_basis2.dag()*o_basis2
return Qobj([[a.data[0,0],b.data[0,0]],[c.data[0,0],d.data[0,0]]])
In [4]:
Phv = H*H.dag() - V*V.dag()
Phv
Out[4]:
In [5]:
psi = 1/sqrt(5)*H + 2/sqrt(5)*V
In [6]:
psi.dag()*Phv*psi
Out[6]:
In [7]:
psi.dag()*Phv*Phv*psi
Out[7]:
In [8]:
1- (-0.6)**2
Out[8]:
In [11]:
data = random.choice([1, -1],size=1000000,p=[0.2,0.8])
In [12]:
data.mean()
Out[12]:
In [13]:
data.var()
Out[13]:
In [14]:
P_45 = P45*P45.dag() - M45*M45.dag()
In [15]:
P_45
Out[15]:
In [16]:
P_c = L*L.dag() - R*R.dag()
In [17]:
P_c
Out[17]:
In [ ]: