Compute integral $\int_{-\infty}^\infty \frac{x^4}{1+x^8} \, dx$ Compute the integral. 
$$\int_{-\infty}^\infty \frac{x^4}{1+x^8} \, dx$$
The answer at the back of the book is 
$$\frac{\pi}{4\sin(\frac{3\pi}{8})}$$
 A: HINTS
Integrate around the usual semi-circular contour 
$$C := \{x \in \mathbb{R} : -R \le x \le R\} \cup \{R\mathrm{e}^{\mathrm{i}t} : 0 \le t \le \pi \}$$
Your function has simple poles, for $n=0,1,2,\ldots,7$, at 
$$z=\cos\left(\frac{\pi}{8}+\frac{\pi n}{4}\right) + \mathrm{i} \sin \left(\frac{\pi}{8}+\frac{\pi n}{4}\right)$$
You'll need to find the residues of those in the upper-half plane, i.e. within the above contour.
Apply Cauchy's Residue Theorem, take the limit $R \to \infty$, and show that the integral along the circular part of the arc tends to zero as $R$ tends towards infinity.
The key fact is that $\displaystyle{\oint_C \mathrm{f}(z)~\mathrm{d}z= \int_{-R}^R \mathrm{f}(x)~\mathrm{d}x + \int_0^{\pi}}\mathrm{f}\left(R\mathrm{e}^{\mathrm{i}t}\right) \cdot \mathrm{i}R\mathrm{e}^{\mathrm{i}t}~\mathrm{d}t$.
Once $R > 1$ we are clear of all of the poles and so the integral around $C$ does not change; let it equal $L$. If we can show that the integral around the circular arc tends to zero as $R \to \infty$ we have
$$L = \lim_{R \to \infty}\oint_C \mathrm{f}(z)~\mathrm{d}z= \int_{-\infty}^{\infty} \mathrm{f}(x)~\mathrm{d}x+ 0$$
A: Due to parity, $\displaystyle\int_{-\infty}^\infty\frac{x^4}{1+x^8}~dx=2\int_0^\infty\frac{x^4}{1+x^8}~dx.~$ In general, all integrals of the form 
$\displaystyle\int_0^\infty\frac{x^{n-1}}{(1+x^m)^p}~dx$ are solved by letting $t=\dfrac1{(1+x^m)^p},~$ then recognizing the expression 
of the beta function in the new integral, and lastly applying Euler's reflection formula for 
the $\Gamma$ function, finally arriving at $I=\displaystyle\frac1m\cdot B\bigg(p-\frac nm~,~\frac nm\bigg),~$ which for $p=1$ becomes 
$\dfrac\pi m\cdot\csc\bigg(n\dfrac\pi m\bigg),~$ where $\csc x=\dfrac1{\sin x}~.~$ By replacing m and n, and taking into account 
the fact that $\sin x=\sin(\pi-x)$, we ultimately get the desired result.
A: As an alternative, integrate over a wedge contour in the first quadrant of radius $R$ and angle $\pi/4$.  This contour encloses only one simple pole (at $z=e^{i \pi/8}$), so application of the residue theorem is simplified.
The contour integral is
$$\int_0^R dx \frac{x^4}{1+x^8} + i R \int_0^{\pi/4} d\theta \, e^{i \theta} \frac{R^4 e^{i 4 \theta}}{1+R^8 e^{i 8 \theta}} + e^{i \pi/4} \int_R^0 dt \frac{-t^4}{1+t^8}$$
I leave it to the reader to show that the second integral in fact vanishes as $R \to \infty$.  Thus, by the residue theorem we have
$$\left (1+e^{i \pi/4} \right ) \int_0^{\infty} dx \frac{x^4}{1+x^8} = i 2 \pi \frac{e^{i 4 \pi/8}}{8 e^{i 7 \pi/8}}$$
Then,
$$\int_0^{\infty} dx \frac{x^4}{1+x^8} = 2 \pi \frac{e^{i \pi/8}}{8(1+e^{i \pi/4})} = \frac{\pi}{8\cos{(\pi/8)}} = \frac{\pi}{8\sin{(3\pi/8)}} $$
A: Supplementing Fly by Night's answer with a trick sometimes handy when calculating the residues at a root of unity.
Write $P(z)=z^4$, $Q(z)=z^8+1$, $f(z)=P(z)/Q(z)$.


*

*The poles in the upper half plane are $z=z_k=e^{(2k+1)\pi i/8},k=0,1,2,3$.  Their complex conjugates are the other four poles, so they are all simple. A trick is to use the fact that $z_k^8=-1$. Therefore
$$ Res(f;z_k)=\frac{P(z_k)}{Q'(z_k)}=\frac{z_k^4}{8z_k^7}=\frac{z_k^5}{8z_k^8}=-\frac18z_k^5.$$

*For further simplification it is helpful to observe that for all the poles $z_k$ we have $z_k^4=\pm i$. The choices of the signs work out nicely in that the contributions of $z_0$ and $z_3$ (resp. $z_1$ and $z_2$) sum up to simple real values of a trig function. The known values
$$
\cos\frac{\pi}8=\frac12\sqrt{2+\sqrt2},\quad\sin\frac{\pi}8
=\frac12\sqrt{2-\sqrt2}
$$
come in handy, and
$$
\begin{aligned}
\int&=2\pi i\sum_{k=0}^3Res(f,z_k)\\
&=-\frac{\pi i}4(z_0^5+z_1^5+z_2^5+z_3^5)\\
&=-\frac{\pi i}4(iz_0-iz_1+iz_2-iz_3)\\
&=\frac{\pi}4[(z_0-z_3)-(z_1-z_2)]\\
&=\frac{\pi}4[2\sin\frac{3\pi}8-2\sin\frac{\pi}8]\\
&=\frac{\pi}4[2\cos\frac{\pi}8-2\sin\frac{\pi}8]\\
&=\frac{\pi}4\left(\sqrt{2+\sqrt2}-\sqrt{2-\sqrt2}\right).
\end{aligned}
$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[5px,#ffd]{\int_{-\infty}^{\infty}{x^{4} \over 1 + x^{8}} \,\dd x} = 2\int_{0}^{\infty}{x^{4} \over 1 + x^{8}} \,\dd x
\\[5mm] \,\,\,\stackrel{x^{8}\ \mapsto\ x}{=}\,\,\, &
{1 \over 4}\int_{0}^{\infty}{x^{\color{red}{5/8} - 1} \over 1 + x} \,\dd x
\end{align}
Note that $\ds{{1 \over 1 + x} = \sum_{k = 0}^{\infty}
\color{red}{\Gamma\pars{1 + k}}{\pars{-x}^{k} \over k!}}$. Then,
\begin{align}
&\!\!\!\!\!\bbox[5px,#ffd]{\int_{-\infty}^{\infty}{x^{4} \over 1 + x^{8}} \,\dd x} = {1 \over 4}\,
\Gamma\pars{\color{red}{5 \over 8}}
\Gamma\pars{1 -\color{red}{5 \over 8}}\,,\
\pars{\substack{\ds{Ramanujan's}\\[0.5mm] \ds{Master}\\[0.65mm] \ds{Theorem}}}
\\[5mm] = &\
\bbx{\pi \over 4\sin\pars{3\pi/8}} \approx 0.8501 \\ &
\end{align}
A: Note
\begin{align}
\int_{-\infty}^\infty \frac{x^4}{1+x^8} dx
& =-\frac1{2i}\int_{-\infty}^\infty \left(\frac{1}{1+i x^4} - \frac{1}{1-i x^4} \right)dx \\
& = -\text{Im} \int_{-\infty}^\infty \frac{1}{1+i x^4}dx
\overset{t=i^{1/4}x} =  -\text{Im} \left( e^{-i\frac\pi8}\int_{-\infty}^\infty \frac{1}{1+t^4}dt\right)\\
&=   -\text{Im} \left( e^{-i\frac\pi8}\cdot \frac\pi{\sqrt2} \right)= \frac\pi{\sqrt2}\cdot\sin\frac\pi8= \frac\pi2\sqrt{1-\frac1{\sqrt2}}
\end{align}
