# How do I solve for the normalization constant of a discrete time-frequency Gabor atom?

Given the mathematical expression for the discrete Gabor time-frequency atom $$g_{s,u,\omega,\theta}(n) = \frac{K_{s,u,\omega,\theta}}{\sqrt{s}} e^{-\pi(n-u)^2/s^2} \cos[2\pi\omega(n-u)+\theta]$$ where the variables are described in the original paper here (page 6 of the PDF), how do I solve for the normalization constant $$K_{s,u,\omega,\theta}$$? My attempt was to solve for the normalization constant using the equation $$\int_{-\infty}^{\infty}|g_{s,u,\omega,\theta}(n)|^2\mathrm dn = \int_{0}^{N}|g_{s,u,\omega,\theta}(n)|^2\mathrm dn = 1$$ where $$n$$ is the time index and $$N$$ is the total number of samples in the atom, but I have not arrived at a solution. Any help would be great. Thanks!

$$||g||^2 = \sum_{n=0}^{N-1} |g(n)|^2 = 1$$
To norm, we set $$K = 1/||g||$$ (rather than $$1/||g||^2$$).
I don't know if there's a closed form solution, as WolframAlpha can't even do $$\sum e^{-n^2}$$. The context usually implies translation invariance, so the result should be independent of $$u$$, but I can't tell for this paper. In practice we simply do
g /= sqrt(sum(abs(g)**2))