Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining Wigner for particle bases #420

Open
DhruvaSambrani opened this issue Oct 1, 2024 · 5 comments
Open

Defining Wigner for particle bases #420

DhruvaSambrani opened this issue Oct 1, 2024 · 5 comments

Comments

@DhruvaSambrani
Copy link

Given a state in the position/momentum bases, we can calulcate the wigner function as (black text)

image

as defined in wiki.

We should implement this function for states on the particle bases.

@DhruvaSambrani
Copy link
Author

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

@DhruvaSambrani DhruvaSambrani changed the title Defiing Wigner for particle bases Defining Wigner for particle bases Oct 1, 2024
@Krastanov
Copy link
Collaborator

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.

@david-pl
Copy link
Member

david-pl commented Oct 2, 2024

FYI, there is already a transform implemented that changes from position to Fock basis and vice versa (see https://docs.qojulia.org/api/#QuantumOpticsBase.transform). You could also use that to transform your state to a FockBasis and compute the Wigner function using the one already implemented.
I'm not sure if that aligns with the linked definition though and finding the right xvec and yvec to pass into wigner may be tricky.

@DhruvaSambrani
Copy link
Author

This would probably not be ideal since there are approximation steps (an upper limit to n) at each representation. This is probably also why this is not default behavior?

I may however be wrong, so please take with salt.

@david-pl
Copy link
Member

david-pl commented Oct 3, 2024

Well that cutoff (and potentially offset) should essentially just be the same as the xmin, xmax, N you choose to represent your PositionBasis. But yes, these need to be chosen such that they represent the same basis, which is an additional pitfall and probably not ideal. You could try it out, though. Might be that the choice turns out to be obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants