A double sum with complex numbers having stochastic variables I am very confused by a sum I have been trying to solve analytically/ numerically for a long time. It comes from the idea of a physical problem where the observation is made that has a combined response of a number of entities. For example, I want to evaluate the mathematical sum at a observation point $\omega$ that looks like the following when $M \to \infty$ .
$$ L(\omega) = \sum_{n = 0}^{N-1}\sum_{m = 1}^{M} \exp\left(i \left( (\omega_m - \omega)n + \beta_m \right) \right)   $$
Where all $\omega_m$s are random draws from a normal distribution
$$ \omega_m \sim \mathcal{N}(\mu, \sigma^2) $$
and the $\beta_m$ are the normal draws from a uniform distribution
$$ \beta_m \sim \mathcal{U}[-\pi, +\pi] $$
Let's try to solve it first with the sum with respect to $m$ and then $n$. The sum with respect to  $m$ can be approximated to an infinite integral when $M \to \infty$.
$$ \mathbb{E}(L(\omega)) \approx M \sum_{n = 0}^{N-1} \int_{-\infty}^{+\infty} \int_{-\pi}^{+\pi} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)\exp(i(x - \omega)n)\frac{1}{2\pi} \exp(i\beta) d\beta dx $$
This integral is $0$ because of the integral $\int_{-\pi}^{+\pi}\exp(i\beta) d\beta$.
Let's approach this sum first with respect to $n$ and then $m$. The function has a closed form with respect to the sum with $n$.
$$ L(\omega) = \sum_{m = 1}^{M} \frac{\sin\left( \frac{N (\omega_m-\omega)}{2} \right)}{\sin\left( \frac{(\omega_m-\omega)}{2} \right)} \exp\left(i \left( (1-N)\frac{\omega_m-\omega}{2} - \beta_m \right) \right)$$
If I take the expectation here with an integral approximation, it also becomes $0$. However, I proceeded with finding the expression for the absolute value of $L(\omega)$ from the above expression.
$$ |L(\omega)|^2 = \sum_{m = 1}^{M} \left| \frac{\sin\left( \frac{N (\omega_m-\omega)}{2} \right)}{\sin\left( \frac{(\omega_m-\omega)}{2} \right)} \right|^2  + \sum_{p = 1}^{P} \sum_{q = 1}^{Q}  \frac{\sin\left( \frac{N (\omega_p-\omega)}{2} \right)}{\sin\left( \frac{(\omega_p-\omega)}{2} \right)} \frac{\sin\left( \frac{N (\omega_q-\omega)}{2} \right)}{\sin\left( \frac{(\omega_q-\omega)}{2} \right)} \cos\left( (1 - N) \frac{(\omega_p-\omega_q)}{2} + \beta_q - \beta_p  \right) $$. The sum with $p$ and $q$ are similar to $m$. The second term is clearly $0$ based on the same type of approximations with expected value when $M \to \infty$. So, taking only the first term, the expected value becomes,
$$ |L(\omega)|^2  \approx M \int_{-\infty}^{+\infty} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) \left| \frac{\sin\left( \frac{N (x-\omega)}{2} \right)}{\sin\left( \frac{(x-\omega)}{2} \right)} \right|^2 dx $$
Can I further reduce this to a closed form or a form that can only depend on $N$ numerically?
Let's take a simpler form by choosing $\mu = 0$, $\sigma = 1$ and find the integral at $\omega = 0$.
$$ |L(0)|^2  \approx M \int_{-\infty}^{+\infty} \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{(x)^2}{2}\right) \left| \frac{\sin\left( \frac{N (x)}{2} \right)}{\sin\left( \frac{(x)}{2} \right)} \right|^2 dx $$
 A: Your final integral can be readily evaluated by expanding the fraction of sines into sums of exponentials $e^{ikx/2}$ with integer $k$, and integrating term by term with the Gaussian weight, to arrive at
$$|L(0)|^2  \equiv\frac{M}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} e^{-x^2/2}  \frac{\sin^2\left(Nx/2 \right)}{\sin^2\left( x/2 \right)} \, dx=$$
$$=MN+2M e^{-N^2/2} \sum _{k=1}^{N-1} k e^{\frac{1}{2} \left(2 k N-k^2\right)}.$$
A: I tried the way @Carlo suggested in the answer.
First, I tried expanding the sine ratio term.
$$ \left( \frac{\sin(Nx/2)}{\sin(x/2)} \right)^2 = \left( \frac{  \exp(i N x/2) - \exp(-iN x/2)  }{ \exp(i x/2) - \exp(-ix/2) } \right)^2 $$
$$ = \exp({-i(N-1)x}) \left( \frac{  \exp(i N x) - 1  }{ \exp(i x) - 1 } \right)^2 $$
If I replace $t = \exp(ix)$, then this expression becomes,
$$ = t^{-(N-1)} \left( \frac{  t^{N} - 1  }{ t - 1 } \right)^2  $$
$$ = t^{-(N-1)} [1 + t + t^2 + t^3 + ... + t^{N-1}]^2 $$
$$ = t^{-(N-1)} [1 + 2t + 3t^2 + 4t^3 + ... + N t^{N-1} + (N-1)t^{N+1} + ... + t^{2N-1}] $$
$$ = t^{-(N-1)} [1 + \sum_{p=1}^{N-1} (p+1) t^{p} + (N-p) t^{N+p}] $$
$$ = [t^{-(N-1)} + \sum_{p=1}^{N-1} (p+1) t^{p-N+1} + (N-p) t^{p+1} ] $$
$$ = [\exp({-ix(N-1)}) + \sum_{p=1}^{N-1} (p+1) \exp({ix(p-N+1)}) + (N-p) \exp({ix(p+1)} )]  $$
So the original integral is,
$$ I = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} \exp(-x^2/2)  \left[\exp({-ix(N-1)}) + \sum_{p=1}^{N-1} (p+1) \exp({ix(p-N+1)}) + (N-p) \exp({ix(p+1)} )\right]  dx  $$
We know the integral of
$$ \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} \exp(-x^2/2) \exp(iax) dx = \exp{(-a^2/2)}$$
Hence,
$$ I = \exp\left({-\frac{(N-1)^2}{2}}\right) + \sum_{p=1}^{N-1} (p+1) \exp\left({-\frac{(p-N+1)^2}{2}}\right) + (N-p) \exp\left({-\frac{(p+1)^2}{2}}\right) $$
So,
$$ |L(0)|^2 \approx M \left[ \exp\left({-\frac{(N-1)^2}{2}}\right) + \sum_{p=1}^{N-1} (p+1) \exp\left({-\frac{(p-N+1)^2}{2}}\right) + (N-p) \exp\left({-\frac{(p+1)^2}{2}}\right)  \right]$$
Is this what I am supposed to get? Just want to verify it. The solutions don't look exactly the same.
