qutip / qutip

QuTiP: Quantum Toolbox in Python
https://qutip.org
BSD 3-Clause "New" or "Revised" License
1.69k stars 635 forks source link

How to plot wigner function of the mathieu functions? #792

Closed DrAliUsman closed 3 years ago

DrAliUsman commented 6 years ago

ce 0

I m obtaining this using code: from numpy import * from scipy.special import mathieu_cem import matplotlib.pyplot as plt from matplotlib import cm from scipy.integrate import quad

Parameters

i = 1.0j x = linspace(-pi,pi,200) p = linspace(-5,5,200) x, p = meshgrid(x, p) y = linspace(-pi, pi, 200)

psi = (mathieu_cem(0,-1,(x-y/2)180/pi)[0]) psic = transpose(conj(mathieu_cem(0,-1,(x+y/2)180/pi)[0]))

Defining the integral

def integrand(y, x, p): return psic psi exp(2 i p * y)

Generate Wigner function

def W(x, p): return quad(integrand, -pi, pi, args=(x, p))[0]

W = vectorize(W)

Plotting the Distribution

fig, axes = plt.subplots() cont = axes.contourf(x, p, W, 1000, cmap=cm.jet) axes.set_xlabel(r'x') axes.set_ylabel(r'p', labelpad=-10) cb = fig.colorbar(cont, ax=axes) # add colour bar plt.show()

Any better arrangement?

nathanshammah commented 5 years ago

I am not knowledgeable about the topic. Could you reference some literature and area of interest? Regarding https://github.com/usmanmacer/Wigner-Mathieu, if possible, please consider opening a Pull Request if this code or notebook example could be added as a special Wigner function instance.

jakelishman commented 3 years ago

Closing as I'm not sure this is related to QuTiP. Seems to be a question about the general statistical Wigner function, not the quantum quasiprobability distribution (which is derived from it).