# Lecture 16: Gallery of Wigner functions¶

Author: J.R. Johansson, [email protected], http://jrjohansson.github.io

In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np

In [2]:
from qutip import *


## Parameters¶

In [3]:
N = 20

In [4]:
def plot_wigner_2d_3d(psi):
#fig, axes = plt.subplots(1, 2, subplot_kw={'projection': '3d'}, figsize=(12, 6))
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 [5]:
psi = basis(N, 0)
plot_wigner_2d_3d(psi)

Out[5]:

## Thermal states¶

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

Out[6]:

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

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

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

Out[8]:

## Superposition of coherent states¶

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

Out[9]:
In [10]:
psi = (coherent(N, -2.0) - coherent(N, 2.0)) / np.sqrt(2)
plot_wigner_2d_3d(psi)

Out[10]: