In [1]:
from numpy import sqrt
from qutip import *
In [2]:
N = 10 # pick a size for our state-space
a = destroy(N)
n = a.dag()*a
In [3]:
a*a.dag() - a.dag()*a
Out[3]:
In [4]:
n*a.dag() - a.dag()*n
Out[4]:
In [5]:
n*a.dag() - a.dag()*n == a.dag()
Out[5]:
In [6]:
psi = basis(N,2)
In [7]:
psi
Out[7]:
In [8]:
a.dag()*psi
Out[8]:
In [9]:
a.dag()*basis(N,2) == sqrt(3)*basis(N,3)
Out[9]:
In [10]:
a
Out[10]:
In [11]:
a.dag()
Out[11]:
In [12]:
X = 1/2 * (a + a.dag())
P = 1/2j * (a - a.dag())
In [13]:
psi = 1/sqrt(2)*(basis(N,1)+basis(N,2))
ex = psi.dag()*X*psi
exq = psi.dag()*X*X*psi
ep = psi.dag()*P*psi
epq = psi.dag()*P*P*psi
In [14]:
deltaX = sqrt(exq[0][0][0] - ex[0][0][0]**2)
deltaP = sqrt(epq[0][0][0] - ep[0][0][0]**2)
In [15]:
deltaX * deltaP * 2 # compare to uncertainty relation (ΔxΔp >= 1/2)
# the factor of two is to convert from the unitless version of the operator
Out[15]:
Alternatively, we can find the indeterminacy bound for ΔX and ΔP (the unitless operators): $$\Delta X \Delta P \geq \frac{1}{2}\left|\left\langle \left[\hat{X},\hat{P}\right] \right\rangle\right|$$
In [31]:
1/2*(psi.dag()*commutator(X,P)*psi).norm()
Out[31]:
Which is also satisfied by the calculated value (1.41 > 0.25)
In [16]:
psi = 1/sqrt(2)*(basis(N,2)+basis(N,4))
ex = psi.dag()*X*psi
exq = psi.dag()*X*X*psi
ep = psi.dag()*P*psi
epq = psi.dag()*P*P*psi
In [17]:
deltaX = sqrt(exq[0][0][0] - ex[0][0][0]**2)
deltaP = sqrt(epq[0][0][0] - ep[0][0][0]**2)
In [19]:
deltaX * deltaP * 2 # to compare to book solution which uses the full x and p operators with units
Out[19]:
In [ ]: