Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

Thanks.

share|improve this question

marked as duplicate by Mike Honeychurch, bobthechemist, Sjoerd C. de Vries, rm -rf Jan 2 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. –  rm -rf Jan 1 at 1:30

2 Answers 2

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;

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.