/// <summary> /// Calculates the value of a (freely evolving) Gaussian wavepacket at a given location and time. /// </summary> public static Complex FreeGaussianWavePacketValue(float x, float y, float z, float t, Vec3 initialCenter, Vec3 initialWidth, Vec3 avgMomentum, float mass) { Complex I = Complex.I; Complex effSigmaXSq = initialWidth.X * initialWidth.X + I * (t / mass); Complex effSigmaYSq = initialWidth.Y * initialWidth.Y + I * (t / mass); Complex effSigmaZSq = initialWidth.Z * initialWidth.Z + I * (t / mass); float xRel = x - initialCenter.X - avgMomentum.X * t / mass; float yRel = y - initialCenter.Y - avgMomentum.Y * t / mass; float zRel = z - initialCenter.Z - avgMomentum.Z * t / mass; float avgMomentumSq = avgMomentum.NormSq(); Complex expArg = I * (x * avgMomentum.X + y * avgMomentum.Y + z * avgMomentum.Z) - I * t * avgMomentumSq / (2 * mass) - (xRel * xRel) / (2 * effSigmaXSq) - (yRel * yRel) / (2 * effSigmaYSq) - (zRel * zRel) / (2 * effSigmaZSq); float rootPi = (float)Math.Sqrt(Math.PI); Complex normX = Complex.Sqrt(initialWidth.X / (rootPi * effSigmaXSq)); Complex normY = Complex.Sqrt(initialWidth.Y / (rootPi * effSigmaYSq)); Complex normZ = Complex.Sqrt(initialWidth.Z / (rootPi * effSigmaZSq)); Complex wfVal = normX * normY * normZ * Complex.Exp(expArg); return(wfVal); }