Wigner Function Notebook
This notebook guide computes Wigner functions from wavefunctions and then tests the result more aggressively than a phase-space plot can. A Gaussian state supplies exact normalization, marginals, covariance, and purity benchmarks. Harmonic-oscillator evolution supplies an exact phase-space rotation. A coherent superposition of separated packets supplies interference fringes and genuine negativity.
The definition and interpretation of the Wigner function belong to Wigner Function. Marginals and Quasi-Probabilities owns the meaning of marginals and negativity, while Phase-Space Dynamics owns the Wigner–Moyal evolution equation. This page owns the numerical transform, grid conventions, validation suite, and failure diagnosis.
Purpose
Section titled “Purpose”The notebook should demonstrate that:
- a relative-coordinate Fourier transform reconstructs the Wigner function with the intended normalization;
- position and momentum marginals agree with independently computed Born distributions;
- a Gaussian Wigner function is real, normalized, pure, and nonnegative within numerical tolerance;
- harmonic evolution rotates a Wigner function exactly in scaled phase space;
- a coherent superposition produces resolved negative interference fringes;
- relative-coordinate truncation, half-grid interpolation, FFT scaling, and momentum aliasing are independent error sources;
- small negative pixels are not evidence of physical Wigner negativity until they converge under refinement.
Every plotted Wigner function should have a numerical validation record. Color alone cannot establish normalization, purity, or negativity.
Convention
Section titled “Convention”Use the same convention as the canonical phase-space pages:
Equivalently, with ,
Both formulas are correct. They imply different discrete frequency maps when and are sampled on different grids. Choose one form for the implementation and derive its momentum grid before writing code.
The notebook should use the form because it maps directly to an ordinary Fourier transform with conjugate variable .
Relative-Coordinate Correlation
Section titled “Relative-Coordinate Correlation”For each phase-space position , define
Then
The Wigner transform is therefore a family of one-dimensional Fourier transforms, one for each output position. Its cost is approximately
when an FFT is used along the relative-coordinate axis.
The correlation probes off-diagonal coherence. For fixed , large samples wavefunction values far apart. Truncating too early removes long-range coherence and produces ringing in momentum.
Discrete FFT Formula
Section titled “Discrete FFT Formula”Choose an evenly spaced relative grid
with even . The quadrature approximation is
For the standard forward DFT, the physical momentum bins are
followed by the same frequency shift used on the FFT output. Thus
and the momentum Nyquist scale is
The implementation sequence is:
- place the centered array into FFT order with an inverse shift;
- apply the forward FFT;
- shift the output and the frequency bins together;
- multiply by .
A missing , , or changes both normalization and the momentum axis.
The Half-Grid Problem
Section titled “The Half-Grid Problem”The arguments
do not generally lie on the original wavefunction grid. There are three controlled options:
- evaluate an analytic benchmark wavefunction directly at the shifted points;
- evaluate the numerical wavefunction on a grid with half the output spacing;
- interpolate the complex wavefunction and demonstrate interpolation convergence.
The second option avoids interpolation. If output positions are separated by and , store on a fine grid of spacing . Choose output at every second fine-grid point. Then
always lands on the fine grid.
Interpolating the density is not sufficient. The Wigner transform needs the complex amplitude and relative phase.
A Common Aliasing Trap
Section titled “A Common Aliasing Trap”Another popular discretization samples the form at :
The factor of two in the exponential means the DFT momentum bins are
not the ordinary wavefunction-FFT bins
Assigning the ordinary bins doubles the physical momentum axis and aliases features. The -grid implementation avoids this ambiguity by using the standard Fourier pair explicitly.
Gaussian Benchmark
Section titled “Gaussian Benchmark”Use the normalized packet
Its momentum width is
and its exact Wigner function is
Compare the complete complex numerical transform with this formula. The imaginary part should vanish to numerical tolerance, and the real part should converge pointwise and in an integrated norm.
Normalization and Marginals
Section titled “Normalization and Marginals”On a rectangular phase-space grid, compute
The target is
The position marginal is
and should agree with
The momentum marginal is
Compare it with an independently normalized Fourier transform of , evaluated on the same physical momentum grid. Deriving both arrays from the same incorrectly scaled Wigner transform is not an independent check.
Reality, Purity, and Overlaps
Section titled “Reality, Purity, and Overlaps”For a Hermitian density operator, is real. Report
For one degree of freedom,
Thus a pure state satisfies
For two pure states,
These identities are sensitive to normalization and phase-space cell area. They are valuable checks beyond the marginals.
Moments and Covariance
Section titled “Moments and Covariance”For Weyl-ordered polynomial observables, phase-space moments reproduce quantum expectations:
and
Construct the numerical covariance matrix
For the minimum-uncertainty Gaussian,
Compare these moments with direct wavefunction calculations. A Wigner array can pass normalization while using a shifted or reflected momentum convention; first moments catch that error.
Harmonic-Oscillator Evolution
Section titled “Harmonic-Oscillator Evolution”Use a displaced Gaussian with
so its Wigner ellipse is visibly squeezed relative to the oscillator ground state. Expand the wavefunction in the oscillator energy basis, evolve the coefficients by
reconstruct , and compute .
For the quadratic oscillator, the exact Wigner evolution is a classical phase-space rotation:
where
and
Compare the numerically transformed evolved wavefunction with this rotated initial Wigner function. The test simultaneously checks basis evolution, complex wavefunction reconstruction, Wigner transformation, and phase-space orientation.
The center should follow
The covariance should rotate without changing its determinant.
Superposition-State Benchmark
Section titled “Superposition-State Benchmark”Let be real minimum-uncertainty Gaussian packets of width centered at
with zero mean momentum. Their overlap is
Define
where
Its exact Wigner function is
The first two terms are positive packet lobes. The last term is the interference contribution. It oscillates in momentum with fringe spacing
The numerical momentum spacing must resolve this scale.
Odd Superposition and Exact Negativity
Section titled “Odd Superposition and Exact Negativity”Choose
The state is odd under parity. At the phase-space origin,
independent of and when the state is normalized. This is a sharp pointwise benchmark for sign, normalization, phase convention, and interpolation.
Use
as the baseline. The negative interference bands should be clearly separated from the positive lobes.
Negative Volume
Section titled “Negative Volume”For a normalized continuous Wigner function, define
On a numerical grid, use the equivalent signed form
Report separately rather than forcing it to one. For the Gaussian benchmark, should converge to zero. Its residual value defines a numerical negativity floor. The superposition negativity is credible only when it remains well above that floor and converges under all relevant refinements.
Baseline Grids
Section titled “Baseline Grids”Set
For the static Gaussian use
Choose
Then
For harmonic evolution use a narrower initial width such as
to make covariance rotation visible. For the odd superposition use the and values above.
These values produce a useful first run for analytic wavefunction evaluation. Generic numerical wavefunctions still require independent interpolation, basis-cutoff, and boundary studies.
Notebook Workflow
Section titled “Notebook Workflow”Organize the notebook into these stages:
- define the Fourier and Wigner conventions;
- construct the , , and derived grids;
- assert the FFT frequency spacing and ordering;
- evaluate the Gaussian correlation array;
- apply the shifted FFT with the physical prefactor;
- compare with the analytic Gaussian Wigner function;
- validate reality, normalization, both marginals, moments, covariance, purity, and zero negativity;
- evolve a squeezed Gaussian in the oscillator basis;
- compare its numerical Wigner function with exact phase-space rotation;
- evaluate the odd superposition and compare with its analytic Wigner function;
- measure , fringe spacing, and negative volume;
- repeat the grid, domain, relative-range, and interpolation refinements;
- run assertions before producing final plots.
Record array shapes, endpoint conventions, shift order, FFT normalization, physical spacings, interpolation method, and all tolerances.
Validation Checks
Section titled “Validation Checks”The minimum validation suite is:
| Check | Target |
|---|---|
| Grid map | and shifted ordering agree |
| Reality | imaginary residual approaches zero |
| Normalization | |
| Position marginal | agrees with |
| Momentum marginal | agrees with an independent wavefunction FFT |
| Gaussian formula | full Wigner array converges to |
| First moments | reproduce and |
| Covariance | agrees with direct wavefunction moments |
| Purity | for every pure benchmark |
| Gaussian negativity | converges to zero and defines the error floor |
| Harmonic transport | agrees with exact phase-space rotation |
| Phase-space determinant | remains for the pure Gaussian |
| Odd superposition | |
| Fringe spacing | agrees with |
| Superposition negativity | stabilizes above the numerical floor |
For harmonic evolution, also check that a full oscillator period returns the Wigner function to itself. This test is insensitive to the wavefunction’s global phase, as a density-operator representation should be.
Convergence Study
Section titled “Convergence Study”Vary the numerical scales independently:
- Position range. Increase the wavefunction domain and monitor boundary amplitude.
- Output spacing. Refine while keeping physical ranges fixed.
- Relative range. Increase at fixed to refine momentum spacing.
- Relative spacing. Decrease at fixed relative range to increase momentum bandwidth.
- Interpolation. Compare analytic evaluation, half-grid sampling, and at least one converged complex interpolation method.
- Oscillator basis. Increase the number-state cutoff used for time evolution.
- Cat separation. Increase and confirm that the required momentum resolution tracks the shrinking fringe spacing.
Zero padding increases the density of sampled momentum bins but does not restore correlation data that were truncated or wavefunction structure that was under-resolved. Distinguish interpolation of a transform from increased physical resolution.
Visualization
Section titled “Visualization”Use a signed diverging color map centered exactly at zero. Set symmetric color limits when comparing positive and negative amplitudes, and include a color bar with physical units. Plot and on their actual derived grids.
For the Gaussian, show contours and marginal panels. For oscillator evolution, use equal-aspect scaled coordinates
so a phase-space rotation is geometrically visible. For the superposition, include a one-dimensional cut through that resolves the predicted cosine fringes.
Do not clip negative values, smooth the Wigner array, or use independent color scales across convergence frames without saying so. Each can hide the numerical signature being tested.
Expected Results
Section titled “Expected Results”For the proposed analytic grids:
- the Gaussian transform agrees with the exact array to near floating-point precision;
- normalization, purity, and both marginals are correspondingly accurate;
- Gaussian negative volume is at the numerical floor;
- the oscillator Wigner ellipse rotates without changing area;
- the transformed evolved wavefunction agrees with the backward-rotated initial Wigner function;
- the odd superposition reaches for ;
- its negative volume stabilizes near for the baseline and ;
- coarsening the momentum grid first corrupts the interference fringes;
- truncating the relative-coordinate range produces momentum ringing;
- using the wrong FFT momentum map shifts or doubles all momentum-space features.
The near-machine-precision static benchmarks rely on analytic evaluation at shifted points. A generic interpolated wavefunction should be held to a convergence-based tolerance instead.
Common Numerical Failures
Section titled “Common Numerical Failures”- Using the -grid formula with ordinary FFT momentum bins. The factor of two changes the physical frequency map.
- Interpolating probability density instead of the complex wavefunction.
- Shifting the FFT output without shifting the frequency bins, or vice versa.
- Dropping .
- Including duplicate periodic endpoints in an FFT grid.
- Truncating while it is still appreciable. This causes momentum ringing.
- Calling tiny negative Gaussian pixels physical negativity. Establish the refinement floor first.
- Renormalizing the Wigner array to hide a prefactor or domain error.
- Checking only the position marginal. A wrong momentum axis can still leave it plausible.
- Computing purity without the phase-space cell area and factor.
- Using zero padding as a substitute for physical resolution.
- Smoothing interference fringes before measuring negative volume.
- Plotting unequal scaled axes and misreading rotation as squeezing.
- Treating a positive Gaussian Wigner function as proof that the state is classical.
Extensions
Section titled “Extensions”- Compute Wigner functions for oscillator number states and verify alternating parity at the origin.
- Compare coherent superpositions with incoherent mixtures of the same two packets.
- Apply Gaussian coarse graining and observe how interference negativity is suppressed.
- Reconstruct Wigner functions from simulated quadrature marginals by an inverse Radon transform.
- Evolve the superposition under the harmonic oscillator and verify rigid fringe rotation.
- Introduce a quartic potential and compare classical transport with Moyal corrections.
Cross-Links
Section titled “Cross-Links”- Wigner Function
- Marginals and Quasi-Probabilities
- Phase-Space Dynamics
- Gaussian States and Wigner Functions
- Coherent States in Phase Space
- Phase-Space Conventions
- Gaussian Wave Packets
- Harmonic-Oscillator Propagator Notebook
- Fast Fourier Transform
- Convergence Tests
- Validation Tests
References
Section titled “References”- E. Wigner, “On the Quantum Correction For Thermodynamic Equilibrium,” Physical Review 40, 749–759 (1932).
- M. Hillery, R. F. O’Connell, M. O. Scully, and E. P. Wigner, “Distribution Functions in Physics: Fundamentals,” Physics Reports 106, 121–167 (1984), doi:10.1016/0370-1573(84)90160-1.
- W. P. Schleich, Quantum Optics in Phase Space, Wiley-VCH, 2001.
- U. Leonhardt, Measuring the Quantum State of Light, Cambridge University Press, 1997.
- W. B. Case, “Wigner Functions and Weyl Transforms for Pedestrians,” American Journal of Physics 76, 937–946 (2008).
- NumPy Developers, Discrete Fourier Transform documentation, consulted for FFT normalization, frequency ordering, and shift conventions.
Exercises
Section titled “Exercises”1. Derive the FFT momentum grid
Section titled “1. Derive the FFT momentum grid”Starting from the discrete transform, derive and .
Solution
The DFT phase is
The Wigner phase for grid points is
Equating exponents gives
so
Adjacent bins differ by
The largest represented angular frequency has magnitude approximately , giving
2. Prove the position marginal
Section titled “2. Prove the position marginal”Integrate the defining Wigner transform over momentum.
Solution
Start from
The Fourier identity is
The integral therefore evaluates the product at :
3. Derive the odd-cat value at the origin
Section titled “3. Derive the odd-cat value at the origin”Use the analytic superposition Wigner function with to show that .
Solution
At , each positive lobe contributes
The interference term contributes
Thus
For ,
Therefore
4. Explain harmonic backward rotation
Section titled “4. Explain harmonic backward rotation”Why is the evolved Wigner function evaluated at the inverse classical flow rather than the forward coordinates?
Solution
The Wigner value is transported along a trajectory. If a phase-space point moves to
then the density at the final point equals the initial density at its preimage:
The arguments are precisely . Using the forward map inside rotates the pattern in the wrong direction.
5. Show that purity equals one for the Gaussian
Section titled “5. Show that purity equals one for the Gaussian”Evaluate .
Solution
Using
one obtains
For a minimum-uncertainty Gaussian,
so
6. Resolve the interference fringes
Section titled “6. Resolve the interference fringes”Suppose a cat state has packet separation . What relative-coordinate range is needed to sample at least momentum points per fringe?
Solution
The fringe spacing is
The FFT momentum spacing is
At least points per fringe requires
Substitution gives
or
This controls momentum spacing. The separate condition small enough to cover the required momentum bandwidth must also be checked.