wigner
Graham Dennis
Simulation of the Wigner function for an anharmonic oscillator with the initial state being a coherent state.

WARNING: This simulation will take a couple of hours.
/* physical constants */ const real hbar = 1.05457148e-34;

/* system constants */ const real omega = 0.0; const real Uint = 1.0*hbar;

/* initial state constants */ const real alpha_0 = 3.0;

/* used for calculating constants derived from arguments */ bool firstTime = true;

/* absorbing boundary constants */ const real absorb = 8.0; const real width = 0.3;

/* derived constants */ const complex miOmega = -i*omega; const complex miUint_hbar = -i*Uint/hbar; const real Uint_hbar = Uint/hbar;
t
W
W = 2.0/M_PI * exp(-2.0*(y*y + (x-alpha_0)*(x-alpha_0)));
damping
real r = sqrt(x*x + y*y);

if (r > _max_x-width) damping = 0.0; else damping = 1.0;
200
Lx Ly Lxxx Lxxy Lxyy Lyyy
Lx = i*kx; Ly = i*ky; Lxxx = -i*kx*kx*kx; Lxxy = -i*kx*kx*ky; Lxyy = -i*kx*ky*ky; Lyyy = -i*ky*ky*ky;
main
dampConstants
dW_dt = damping * ( (omega + Uint_hbar*(-1.0 + x*x + y*y))*x*Ly[W] - (omega + Uint_hbar*(-1.0 + x*x + y*y))*y*Lx[W] - Uint_hbar/16.0*(x*(Lxxy[W] + Lyyy[W]) -y*(Lxyy[W] + Lxxx[W])) );
WR WI
main
WR = W.Re(); WI = W.Im();