# How to plot Wigner functions for a quantum state [closed]

Given some quantum state $\rho$, I would like to plot its Wigner function. Taking some examples, the Wigner function for number states, coherent states are well known, but it is not clear how one can plot it.

One solution is to truncate the Fock space of the state and find an analytic expression for the Wigner function that can be plotted. Alternatively, and what I am seeking, it can be plotted using a stochastic trajectory approach which samples the distribution. However, I am unsure on how to plot it. Any help would be appreciated!

I would like to plot the Wigner functions for a thermal state, coherent state, displaced coherent states and squeezed thermal states.

## closed as unclear what you're asking by Emilio Pisanty, Noiralef, ZeroTheHero, Cosmas Zachos, user191954 Sep 7 '18 at 8:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• A Wigner function of a coherent state (for example) is an analytic function of the quadrature variables $q$ and $p$. Why not just plot is as a function of $q$ and $p$? – flippiefanus May 29 '18 at 12:20
• @flippiefanus, I want to plot the Wigner function for arbitrary states, so I believe a more general approach is required. The named ones were for examples. – Sid May 29 '18 at 14:56
• First you need to compute the Wigner function for that state. What you'll get is always a function of $q$ and $p$. Give me an example that would not work this way. – flippiefanus May 30 '18 at 4:06
• @flippiefanus, I can always get a Wigner function - true. But my question was how to plot it? – Sid May 31 '18 at 9:56
• Plot is as a function $q$ and $p$. So, you would have a 3D plot where $q$ and $p$ are represented by the coordinates $x$ and $y$ and $z$ represents the magnitude of the Wigner function at those value for $q$ and $p$. – flippiefanus May 31 '18 at 10:26

The so-called Wigner transform turns your density matrix into the corresponding Wigner function. An explicit formula is given at "What is the Wigner function of $|n\rangle\langle m|$?"