# Using DeleteCases to ignore term of Product

I'd like to calculate $\int_{-\infty}^{\infty}\mathrm{d}x/(1+x^6)$ through a variation of the residue formula, which is $\int_{-\infty}^{\infty}f(x)\mathrm{d}x=2\pi i\sum \text{Res }f$ for Residues in the upper half plane.

To calculate this, I've reached the below formula, which I believe to be correct.

$$\int_{-\infty}^{\infty}\frac{\mathrm{d}x}{1+x^6}=2\pi i\sum_{k=0}^{5}\prod_{\substack{j=0\\j\neq k}}^5\frac{1}{e^{\pi i(2k+1)/6}-e^{\pi i(2j+1)/6}}$$

I'd like my Mathematica code to incorporate the $j\neq k$ part of the product, which from this question appears possible with the function DeleteCases. The code I used is displayed below.

RootOfUnity[k_] := Exp[2 \[Pi] I k/6]

Simplify[2 \[Pi] I Sum[Product[1/(RootOfUnity[2 k + 1] - RootOfUnity[2 j + 1]), {j, DeleteCases[Range[0, 5], k]}], {k, 0, 5}]]


This gives me the answer $0$, which disagrees with WolframAlpha calculating the integral to be $2\pi/3$. The problem might be with my derivation of the residues, but does my Mathematica code (specifically the DeleteCases part of it) work how I want it to (based off of my LaTeX equation)?

• Why not do it as 2 π I Total[Residue[1/(1 + t^6), {t, #}] & /@ (t /. Solve[{Denominator[1/(1 + t^6)] == 0, Im[t] >= 0}, t])] // FullSimplify? – J. M.'s discontentment Mar 9 '16 at 2:33
• This is part of a complex analysis problem set, and while the professor said using Mathematica to simplify the algebra at the end is acceptable, I'd prefer the code follows clearly from my derivation. – Mark Mar 9 '16 at 2:35
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Mar 9 '16 at 3:20
• Then, does 2 π I Sum[Product[1/(Exp[π I (2 j - 1)/6] - Exp[π I (2 k - 1)/6]), {k, Delete[Range, j]}], {j, 1, 3}] // Simplify suit your needs? – J. M.'s discontentment Mar 9 '16 at 3:20