Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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.


share|improve this question

marked as duplicate by Mike Honeychurch, bobthechemist, Sjoerd C. de Vries, R. M. Jan 2 '14 at 2:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Look up the documentation for Sum, especially the 4th form. – R. M. Jan 1 '14 at 1:30

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}]}] //  

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;

f[x] // TraditionalForm

enter image description here

Plot[f[x], {x, -15, 15}]

enter image description here

share|improve this answer

Maybe the simplest approach

Sum[If[n == -1 || n == 1, 0, (4 I (-1)^n n)/(1 - n^2)^2 Exp[I n x]], {n, -10, 10}]
share|improve this answer

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