# Lecture 16 - Gallery of Wigner functions¶

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.

In [1]:
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


## Parameters¶

In [2]:
N = 20

In [3]:
def plot_wigner_2d_3d(psi):
fig = plt.figure(figsize=(17, 8))

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


## Vacuum state: $\left|0\right>$¶

In [4]:
psi = basis(N, 0)
plot_wigner_2d_3d(psi)

Out[4]:

## Thermal states¶

In [5]:
psi = thermal_dm(N, 2)
plot_wigner_2d_3d(psi)

Out[5]:

## Coherent states: $\left|\alpha\right>$¶

In [6]:
psi = coherent(N, 2.0)
plot_wigner_2d_3d(psi)

Out[6]:
In [7]:
psi = coherent(N, -1.0)
plot_wigner_2d_3d(psi)

Out[7]:

## Superposition of coherent states¶

In [8]:
psi = (coherent(N, -2.0) + coherent(N, 2.0)) / np.sqrt(2)
plot_wigner_2d_3d(psi)

Out[8]: