Definite integral calculation with poles at $0$ and $\pm i\sqrt{3}$
$$\int_0^\infty \frac{\sin(2\pi x)}{x(x^2+3)} \, dx$$
I looked at $\frac{e^{2\pi i z}}{z^{3}+3z}$, also calculated the residues, but they don't get me the right answer. I used that $\int_{-\infty}^\infty f(z)\,dz = 2\pi i (\sum \operatorname{Res} z_r) + \pi i \operatorname{Res}_0$, but my answer turns out wrong when I check with wolframalpha.
Residue for $0$ is $1$, for $z=\sqrt{3}i$ it's $-\frac{e^{-2\pi}}{2}$ . . .
In a worse attempt I forgot $2\pi$ and used $z$ only (i.e. $\frac{e^{iz}}{z^{3}+3z}$) and the result was a little closer, but missing a factor of 2 and and $i$.
Can anyone see the right way? Please do tell.
We make the following lemma:
Lemma. Suppose $f(z)$ is holomorphic near $z = z_0$. Fix $\theta_0 \in (0, 2\pi)$. If $\gamma_\varepsilon$ denotes a counter-clockwise oriented arc of angle $\theta_0$ on the circle of radius $\varepsilon$ centered at $z_0$, then $$ \lim_{\varepsilon\to0} \int_{\gamma_\varepsilon} \frac{f(\zeta)}{\zeta-z_0}\;d\zeta=i\theta_0 f(z_0).$$
Proof. By the substitution $\zeta = z_0 + \varepsilon e^{i\theta}$, we have $$\begin{align*} \left| \int_{\gamma_\varepsilon} \frac{f(\zeta)}{\zeta-z_0}\;d\zeta - i\theta_0 f(z_0)\right| &= \left| i \int_{\theta_1}^{\theta_1+\theta_0} f(z_0 + \varepsilon e^{i\theta})\;d\theta - i\theta_0 f(z_0)\right| \\ & \leq \int_{\theta_1}^{\theta_1+\theta_0} \left| f(z_0 + \varepsilon e^{i\theta}) - f(z_0) \right| \;d\theta, \end{align*}$$ which clearly goes to zero when $\varepsilon \to 0$.
As a corollary, if $f(z)$ has a simple pole at $z = z_0$ then with the same notation as in the Lemma, we have
$$ \lim_{\varepsilon\to0} \int_{\gamma_\varepsilon} f(\zeta) \;d\zeta=i\theta_0 \operatorname{Res} \{ f(z), z_0 \}.$$
Now let $C$ be the upper-semicircular contour of radius $R \gg 1$ with a small semicircular indent of radius $\varepsilon \ll 1$ at the origin. Let us write $C$ as $$ C = \Gamma_{R} + L_{\varepsilon,R} - \gamma_\varepsilon,$$ where $\Gamma_R$ and $\gamma_\varepsilon$ denote counter-clockwise oriented arcs corresponding to the outer circle and the inner circle of $C$, respectively, and $L_{\varepsilon,R}$ denote the remaining union of two lines on $C \cap \Bbb{R}$. Now for
$$ f(z) = \frac{e^{2\pi i z}}{z(z^2 + 3)}, $$
the integral in question, which we denote as $I$, is equal to
$$I = \frac{1}{2i} \lim_{{\varepsilon \to 0 \atop R \to \infty}} \int_{L_{\varepsilon, R}} f(z) \; dz.$$
Now, by Cauchy integration formula,
$$ \oint_{C} f(z) \; dz = 2\pi i \operatorname{Res} \{ f(z), i\sqrt{3} \}. $$
This means that
$$ \int_{L_{\varepsilon, R}} f(z) \; dz = 2\pi i \operatorname{Res} \{ f(z), i\sqrt{3} \} + \int_{\gamma_\varepsilon} f(z) \; dz - \int_{\Gamma_R} f(z) \; dz. $$
Taking limit $\varepsilon \to 0$ and $R \to \infty$, the integral $\int_{\Gamma_R} f(z) \; dz$ vanishes by Jordan's lemma. Thus by our lemma,
$$ \lim_{{var\epsilon \to 0 \atop R \to \infty}} \int_{L_{\varepsilon, R}} f(z) \; dz = 2\pi i \operatorname{Res} \{ f(z), i\sqrt{3} \} + \pi i \operatorname{Res} \{ f(z), 0 \}.$$
But since
$$ \operatorname{Res} \{ f(z), i\sqrt{3} \} = \left. (z-i\sqrt{3})f(z) \right|_{z=i\sqrt{3}} = -\frac{1}{6}e^{-2\pi \sqrt{3}} $$
and
$$ \operatorname{Res} \{ f(z), 0 \} = \left. z f(z) \right|_{z=0} = \frac{1}{3}, $$
we have
$$ I = \frac{1}{2i} \left[ 2\pi i \left(-\frac{1}{6}e^{-2\pi \sqrt{3}}\right) + \pi i \left(\frac{1}{3} \right) \right] = \frac{\pi}{6}\left(1 - e^{-2\pi \sqrt{3}} \right). $$
$$ \begin{align} \int_0^\infty\frac{\sin(2\pi x)}{x(x^2+3)}\,\mathrm{d}x &=\frac12\int_{-\infty}^\infty\frac{\sin(2\pi x)}{x(x^2+3)}\,\mathrm{d}x\tag{1}\\ &=\frac12\int_{i-\infty}^{i+\infty}\frac{\sin(2\pi z)}{z(z^2+3)}\,\mathrm{d}z\tag{2}\\ &=\frac12\int_{i-\infty}^{i+\infty}\frac{e^{i2\pi z}-e^{-i2\pi z}}{2iz(z^2+3)}\,\mathrm{d}z\tag{3}\\ &=\frac1{4i}\int_{\gamma_+}\frac{e^{i2\pi z}}{z(z^2+3)}\mathrm{d}z -\frac1{4i}\int_{\gamma_-}\frac{e^{-i2\pi z}}{z(z^2+3)}\mathrm{d}z\tag{4}\\ &=\frac{2\pi i}{4i}\frac{e^{-2\pi\sqrt3}}{i\sqrt3(i\sqrt3+i\sqrt3)} +\frac{2\pi i}{4i}\left(\frac13+\frac{e^{-2\pi\sqrt3}}{-i\sqrt3(-i\sqrt3-i\sqrt3)}\right)\tag{5}\\ &=\frac\pi6\left(1-e^{-2\pi\sqrt3}\right)\tag{6} \end{align} $$ where $\gamma_+$ passes from $i-R$ to $i+R$ then circles back counterclockwise around the upper half-plane, and where $\gamma_-$ passes from $i-R$ to $i+R$ then circles back clockwise around the lower half-plane.
$\gamma_+$ contains the singularity at $i\sqrt3$.
$\gamma_-$ contains the singularities at $0$ and $-i\sqrt3$.
Explanation of steps
$(1)$ integrand is an even function.
$(2)$ there are no singularities for the integrand in the rectangle with corners $i-R,i+R,R,-R$ and the integral over the ends of the rectangle vanishes as $R\to\infty$.
$(3)$ write $\sin(2\pi z)=\dfrac{e^{i2\pi z}-e^{-i2\pi z}}{2i}$
$(4)$ use contour $\gamma_+$ for $e^{i2\pi z}$ and $\gamma_-$ for $e^{-i2\pi z}$ so that the integrand vanishes over the large circles in the upper and lower half-planes.
$(5)$ use residues to compute the integrals over $\gamma_+$ and $\gamma_-$.
$(6)$ simplification.
$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ \begin{align} &\color{#00f}{\large% \int_{0}^{\infty}{\sin\pars{2\pi x} \over x\pars{x^{2} + 3}}\,\dd x}= \half\int_{-\infty}^{\infty}{\sin\pars{2\pi x} \over x\pars{x^{2} + 3}}\,\dd x =\pi\int_{-\infty}^{\infty} {1 \over x^{2} + 3}\,\pars{\half\int_{-1}^{1}\expo{2\pi\ic k x}\,\dd k}\,\dd x \\[3mm]&={\pi \over 2}\int_{-1}^{1}\dd k \int_{-\infty}^{\infty}{\expo{2\pi\ic kx} \over x^{2} + 3}\,\dd x \\[3mm]&={\pi \over 2}\int_{-1}^{1}\bracks{% \Theta\pars{-k}\pars{-2\pi\ic}\, {\expo{2\pi\ic k\pars{-\ic\root{3}}} \over -2\ic\root{3}} +\Theta\pars{k}\pars{2\pi\ic}\, {\expo{2\pi\ic k\pars{\ic\root{3}}} \over 2\ic\root{3}}}\,\dd k \\[3mm]&={\pi \over 2}\int_{-1}^{1}{\pi \over \root{3}}\, \expo{-2\pi\root{3}\verts{k}}\,\dd k ={\root{3} \over 3}\,\pi^{2}\int_{0}^{1}\expo{-2\pi\root{3}k}\,\dd k \\[3mm]&={\root{3} \over 3}\,\pi^{2}\,{\expo{-2\pi\root{3}} - 1 \over -2\pi\root{3}} =\color{#00f}{\large{1 \over 6}\,\pi\pars{1 - \expo{-2\pi\root{3}}}} \end{align}