# How to exclude numbers in a series and still plot the graph? [duplicate]

I want to plot this: $\displaystyle\sum_{n=-{10}\atop n\ne \pm 1}^{10} \dfrac {4i(-1)^{n}n}{(n^2 - 1)^2}e^{inx}$

but have no idea how I can exclude the cases for when $n = \pm 1$. I don't wish to split up the summation into two parts either.

Thanks.

-
Look up the documentation for Sum, especially the 4th form. –  rm -rf Jan 1 at 1:30

## marked as duplicate by Mike Honeychurch, bobthechemist, Sjoerd C. de Vries, rm -rf♦Jan 2 at 2:04

I actually couldn't find a question on exclusion of summation indices. Let me know if I missed it.

f[x_] =
Sum[(4 I (-1)^n n)/(1 - n^2)^2 Exp[I n x], {n, Complement[Range[-10, 10], {-1, 1}]}] //
FullSimplify;

or even more proper

f[x_] = Sum[(4 I (-1)^n n)/(1 - n^2)^2 Exp[I n x],
{n, DeleteCases[Range[-10, 10], Alternatives @@ {-1, 1}]}] // FullSimplify;