In [1]:
%pylab inline
In [2]:
from qutip import *
In [3]:
from qutip.distributions import *
In [4]:
N = 20
alpha = 2.0 + 2j
rho = (coherent(N, alpha) + coherent(N, -alpha)).unit()
In [5]:
w = WignerDistribution(rho, extent=[[-10, 10], [-10, 10]])
In [6]:
w.visualize();
In [7]:
q = QDistribution(rho, extent=[[-10, 10], [-10, 10]])
In [8]:
q.visualize(style="surface");
In [9]:
alpha = 1.0
In [10]:
psi = (tensor(coherent(N, alpha), basis(N, 0)) + tensor(basis(N, 0), coherent(N, -alpha))).unit() # superposition
rho = (ket2dm(tensor(coherent(N, alpha), basis(N, 0))) + ket2dm(tensor(basis(N, 0), coherent(N, -alpha)))).unit() # mixture
In [11]:
p = TwoModeQuadratureCorrelation(psi)
In [12]:
p.visualize();
In [13]:
p = TwoModeQuadratureCorrelation(rho)
In [14]:
p.visualize();
In [15]:
fig, axes = subplots(1, 2, figsize=(12, 5))
w0 = WignerDistribution(ptrace(rho, 0))
w1 = WignerDistribution(ptrace(rho, 1))
w0.visualize(fig=fig, ax=axes[0]);
w1.visualize(fig=fig, ax=axes[1]);
In [16]:
alpha = 2.0
rho = (coherent(N, alpha) + coherent(N, -alpha)).unit()
In [17]:
w = WignerDistribution(rho)
In [18]:
w.visualize();
In [19]:
wx = w.marginal(dim=0)
In [20]:
fig, ax = wx.visualize();
In [21]:
wy = w.marginal(dim=1)
In [22]:
fig, ax = wy.visualize();
In [23]:
wx = w.project(dim=1)
In [24]:
fig, ax = wx.visualize();
In [25]:
M=8
fig, ax = subplots(M, 1, figsize=(10, 12), sharex=True)
for n in range(M):
psi = fock(N, n)
wf = HarmonicOscillatorWaveFunction(psi, 1.0, extent=[-10, 10])
wf.visualize(fig=fig, ax=ax[M-n-1], show_ylabel=False, show_xlabel=(n == 0))
In [26]:
psi = coherent(50, 4.0)
wf = HarmonicOscillatorWaveFunction(psi, 1.0, extent=[-15, 15])
wf.visualize();
In [27]:
from qutip.ipynbtools import version_table
version_table()
Out[27]:
In [27]: