Commonly in e.g. condensed matter physics one encounters sums of the form

$\sum_{n=0}^{N-1} \sum_{k} A_k \mathrm{exp}[i\frac{2\pi}{N} kn ]$

where $k$ is summed over all integers in the range $[(-N-1)/2,(N-1)/2]$. The exponential here evaluates to the Kronecker delta:

$\sum_{n=0}^{N-1} \mathrm{exp}[{i 2\pi}{N} kn] = \delta_{n,0}$

so the full sum evaluates to

$N \sum_{k} A_{0} = N^2 A_{0}$.

Unfortunately it is not clear to me how to achieve this computation in Mathematica. For example

kterm = A[k]*(1/Sqrt[N]) Exp[I * 2 Pi * k * n]
ksum = FullSimplify[Sum[kterm, {k, -(N - 1)/2, (N - 1)/2}]]
Sum[ksum, {n, 0, N}] // FullSimplify

yields only the unsimplified expression

$\sum_{n=0}^{N} \sum_k A[k] e^{2ikn\pi}$.

Is it possible to make Mathematica do this?

  • 3
    $\begingroup$ TIP: don't use upper-case variables. N, in particular, has an already built-in meaning (cf. N). As a rule of thumb, always use lower-case user-defined variables/functions. $\endgroup$ Aug 23, 2018 at 20:17
  • $\begingroup$ Your Mathematica code is not an exact match for the equations you have written. I think you are missing a /N. Your final summation limits have also changed. $\endgroup$
    – mikado
    Aug 23, 2018 at 21:43

1 Answer 1


One thing about using Simplify and FullSimplify is that you have to give the function all the information it needs. Let's look at the evaluation of the sum of the exponential that lies at the heart of your question:

FullSimplify[Sum[Exp[I*2 Pi*k*n/nN], {n, 0, nN}]]

This gives an answer, but it's pretty complicated. To get the simple form you are looking for (with the delta function), notice that k is always an integer. Hence:

FullSimplify[Sum[Exp[I*2 Pi*k*n/nN], {n, 0, nN}], k \[Element] Integers]

returns "1" as you might hope.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.