File:Wigner function of simple harmonic oscillator.png

Summary

{{Information |description={{en|1=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.

{{Created with code|l1=matplotlib|c1= 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=2024-08-28 |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.
Category:CC-BY-SA-4.0#Wigner%20function%20of%20simple%20harmonic%20oscillator.pngCategory:Self-published work
Category:Wigner functions Category:Created with Matplotlib code Category:Fock space Category:Created with Matplotlib
Category:CC-BY-SA-4.0 Category:Created with Matplotlib Category:Created with Matplotlib code Category:Fock space Category:Pages with syntax highlighting errors Category:Self-published work Category:Wigner functions