Author: J. R. Johansson (robert@riken.jp), https://jrjohansson.github.io/
This lecture series was developed by J.R. Johannson. The original lecture notebooks are available here.
This is a slightly modified version of the lectures, to work with the current release of QuTiP. You can find these lectures as a part of the qutip-tutorials repository. This lecture and other tutorial notebooks are indexed at the QuTiP Tutorial webpage.
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import display
from qutip import (about, basis, coherent, coherent_dm, displace, fock, ket2dm,
plot_wigner, squeeze, thermal_dm)
%matplotlib inline
N = 20
def plot_wigner_2d_3d(psi):
fig = plt.figure(figsize=(17, 8))
ax = fig.add_subplot(1, 2, 1)
plot_wigner(psi, fig=fig, ax=ax, alpha_max=6)
ax = fig.add_subplot(1, 2, 2, projection="3d")
plot_wigner(psi, fig=fig, ax=ax, projection="3d", alpha_max=6)
plt.close(fig)
return fig
psi = basis(N, 0)
plot_wigner_2d_3d(psi)
psi = thermal_dm(N, 2)
plot_wigner_2d_3d(psi)
psi = coherent(N, 2.0)
plot_wigner_2d_3d(psi)
psi = coherent(N, -1.0)
plot_wigner_2d_3d(psi)
psi = (coherent(N, -2.0) + coherent(N, 2.0)) / np.sqrt(2)
plot_wigner_2d_3d(psi)
psi = (coherent(N, -2.0) - coherent(N, 2.0)) / np.sqrt(2)
plot_wigner_2d_3d(psi)
psi = (coherent(N, -2.0) + coherent(N, -2j) + coherent(N, 2j)
+ coherent(N, 2.0)).unit()
plot_wigner_2d_3d(psi)
psi = (coherent(N, -2.0) + coherent(N, -1j) + coherent(N, 1j)
+ coherent(N, 2.0)).unit()
plot_wigner_2d_3d(psi)
NN = 8
fig, axes = plt.subplots(NN, 1, figsize=(5, 5 * NN),
sharex=True, sharey=True)
for n in range(NN):
psi = sum(
[coherent(N, 2 * np.exp(2j * np.pi * m / (n + 2)))
for m in range(n + 2)]
).unit()
plot_wigner(psi, fig=fig, ax=axes[n])
# if n < NN - 1:
# axes[n].set_ylabel("")
psi = (coherent_dm(N, -2.0) + coherent_dm(N, 2.0)) / np.sqrt(2)
plot_wigner_2d_3d(psi)
for n in range(6):
psi = basis(N, n)
display(plot_wigner_2d_3d(psi))
NN = MM = 5
fig, axes = plt.subplots(NN, MM, figsize=(18, 18),
sharex=True, sharey=True)
for n in range(NN):
for m in range(MM):
psi = (fock(N, n) + fock(N, m)).unit()
plot_wigner(psi, fig=fig, ax=axes[n, m])
if n < NN - 1:
axes[n, m].set_xlabel("")
if m > 0:
axes[n, m].set_ylabel("")
psi = squeeze(N, 0.5) * basis(N, 0)
display(plot_wigner_2d_3d(psi))
psi = squeeze(N, 0.75j) * basis(N, 0)
display(plot_wigner_2d_3d(psi))
psi = squeeze(N, -1) * basis(N, 0)
display(plot_wigner_2d_3d(psi))
psi = (squeeze(N, 0.75j) * basis(N, 0) - squeeze(N, -0.75j)
* basis(N, 0)).unit()
display(plot_wigner_2d_3d(psi))
psi = (
ket2dm(squeeze(N, 0.75j) * basis(N, 0)) +
ket2dm(squeeze(N, -0.75j) * basis(N, 0))
).unit()
display(plot_wigner_2d_3d(psi))
psi = displace(N, 2) * squeeze(N, 0.75) * basis(N, 0)
display(plot_wigner_2d_3d(psi))
psi = (
displace(N, -1) * squeeze(N, 0.75) * basis(N, 0)
- displace(N, 1) * squeeze(N, -0.75) * basis(N, 0)
).unit()
display(plot_wigner_2d_3d(psi))
about()
QuTiP: Quantum Toolbox in Python ================================ Copyright (c) QuTiP team 2011 and later. Current admin team: Alexander Pitchford, Nathan Shammah, Shahnawaz Ahmed, Neill Lambert, Eric Giguère, Boxi Li, Jake Lishman, Simon Cross and Asier Galicia. Board members: Daniel Burgarth, Robert Johansson, Anton F. Kockum, Franco Nori and Will Zeng. Original developers: R. J. Johansson & P. D. Nation. Previous lead developers: Chris Granade & A. Grimsmo. Currently developed through wide collaboration. See https://github.com/qutip for details. QuTiP Version: 4.7.6 Numpy Version: 1.22.4 Scipy Version: 1.12.0 Cython Version: 0.29.37 Matplotlib Version: 3.5.2 Python Version: 3.10.4 Number of CPUs: 4 BLAS Info: Generic OPENMP Installed: False INTEL MKL Ext: False Platform Info: Linux (x86_64) Installation path: /usr/share/miniconda3/envs/test-environment/lib/python3.10/site-packages/qutip ================================================================================ Please cite QuTiP in your publication. ================================================================================ For your convenience a bibtex reference can be easily generated using `qutip.cite()`