Open DhruvaSambrani opened 11 hours ago
A starting point can be
function mywigner(psi)
map(Iterators.product(samplepoints(psi.basis), samplepoints(MomentumBasis(psi.basis)))) do (x, p)
xmax = psi.basis.xmax
xmin = psi.basis.xmin
N = psi.basis.N
dy = (xmax - xmin)/N
getloc(x) = round(Int, (x - xmin)/N) + 1
ys = collect(filter(y->(xmin<x+y<xmax)&&(xmin<x-y<xmax), samplepoints(psi.basis)))
1/(π*ħ) * sum(ys, init=0) do y
conj(psi[getloc(x+y)]) * psi[getloc(x-y)] * cis(2*p*y/ħ) * dy
end
end
end
However, a better approach may be to actually perform a FT instead of running a sum
Starting with a simple implementation is perfectly reasonable. If you have the time, please submit a PR and the rest of us will try to help with review.
Given a state in the position/momentum bases, we can calulcate the wigner function as (black text)
as defined in wiki.
We should implement this function for states on the particle bases.