File:Wigner function of simple harmonic oscillator.png

Original file (1,800 × 1,200 pixels, file size: 759 KB, MIME type: image/png)

Summary

Description
English: The Wigner function of a simple harmonic oscillator at different levels of excitations. The are rescaled by in order to show that the Wigner function oscillates within that radius, and decays rapidly outside of that radius.

Matplotlib code

import numpy as np
from scipy.special import laguerre
import matplotlib.pyplot as plt
from matplotlib import cm

def Wigner(n, q, p):
  r_squared = (n+1) * (q**2 + p**2)
  return ((-1)**n / (np.pi)) * np.exp(-2 * r_squared) * laguerre(n, monic=False)(4 * r_squared)

q = np.linspace(-1, 1, 100)
p = np.linspace(-1, 1, 100)
Q, P = np.meshgrid(q, p)

n_values = [[0, 1, 2],
            [5, 10, 20]]

plot_y = len(n_values[0])
plot_x = len(n_values)
image_width = 6
fig, axes = plt.subplots(plot_x, plot_y, figsize=(image_width*plot_y, image_width*plot_x), subplot_kw={"projection": "3d"})


for i in range(plot_x):
  for j in range(plot_y):
    n = n_values[i][j]
    W = Wigner(n, Q, P)
    ax = axes[i][j]
    ax.contourf(Q, P, W, zdir='z', offset=-1/(np.pi), cmap='coolwarm')
    ax.contourf(Q, P, W, zdir='x', offset=-1, cmap='coolwarm', alpha=0.8)
    # ax.contourf(Q, P, W, zdir='y', offset=3, cmap='coolwarm')

    ax.plot_surface(Q, P, W, vmin=W.min() * 2, cmap=cm.Blues, alpha=0.8)
    ax.set_title(f"n = {n}")

    # ax.set_xlabel("q")
    # ax.set_ylabel("p")
    ax.set_zlim(-1/(np.pi), 1/(np.pi))
plt.tight_layout()
plt.savefig("wigner_sho.png")
plt.show()

Date
Source Own work
Author Cosmia Nebula

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

28 August 2024

image/png

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current00:17, 29 August 2024Thumbnail for version as of 00:17, 29 August 20241,800 × 1,200 (759 KB)Cosmia NebulaUploaded while editing "Phase-space formulation" on en.wiki.x.io

The following page uses this file:

Metadata