How to calculate the integral of $\operatorname{sgn}(\sin\pi/x)$ in the interval $(0,1)$? How can I calculate the integral of $\operatorname{sgn}(\sin\pi/x)$  in the interval $(0,1)$?
I need to calculate this integral, thanks
 A: Outline: In the interval $(1/2,1)$ our function is $-1$. 
In the interval $(1/3,1/2)$, our function is $1$.
In the interval $(1/4,1/3)$, our function is $-1$.
In the interval $(1/5,1/4)$, our function is $1$. 
And so on. The intervals have length $\frac{1}{1\cdot 2}$, $\frac{1}{2\cdot 3}$, $\frac{1}{3\cdot 4}$, and so on.
So the integral ought to be 
$$-\frac{1}{1\cdot2}+\frac{1}{2\cdot 3}-\frac{1}{3\cdot 4}+\frac{1}{4\cdot 5}-\frac{1}{5\cdot 6}+\cdots.$$
If we want a closed form, note that 
$$\ln(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+\frac{x^5}{5}-\frac{x^6}{6}+\cdots.\tag{1}$$
Now calculate $\int_0^{1} \ln(1+x)\,dx$. This is the same as what we obtain when we integrate the series (1) term by term.   
A: $\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}}$
$\ds{\fermi\pars{\mu}\equiv\int_{0}^{1}\sgn\pars{\sin\pars{\mu \over x}}\,\dd x=
     \int_{1}^{\infty}{\sgn\pars{\sin\pars{\mu x}} \over x^{2}}\,\dd x}.
     \qquad\fermi\pars{\pi} = {\large ?}$

\begin{align}
\fermi'\pars{\mu}&=
\int_{1}^{\infty}
{2\delta\pars{\sin\pars{\mu x}}\cos\pars{\mu x}x \over x^{2}}\,\dd x
=2\int_{1}^{\infty}{\cos\pars{\mu x} \over x}
\sum_{n = -\infty}^{\infty}
{\delta\pars{x - n\pi/\mu} \over \verts{\mu\cos\pars{\mu x}}}\,\dd x
\\[3mm]&={2 \over \verts{\mu}}\sum_{n = -\infty}^{\infty}{\sgn\pars{\cos\pars{n\pi}} \over n\pi/\mu}\,\Theta\pars{n - {\mu \over \pi}}
={2\sgn\pars{\mu} \over \pi}\sum_{n = -\infty}^{\infty}{\pars{-1}^{n} \over n}
\Theta\pars{n - {\mu \over \pi}}
\end{align}

\begin{align}
\fermi\pars{\pi} - \overbrace{\fermi\pars{0^{+}}}^{\ds{\to 1}}&
={2 \over \pi}\sum_{n = -\infty}^{\infty}{\pars{-1}^{n} \over n}
\int_{0^{+}}^{\pi}\Theta\pars{n\pi - \mu}\,\dd\mu=-2\ln\pars{2}
\end{align}

$$\color{#44f}{\large%
\int_{0}^{1}\sgn\pars{\sin\pars{\mu \over x}}\,\dd x
=1 - 2\ln\pars{2}}
$$

A: Usually, when you have a function defined by cases, one considers breaking the problem up along those cases.
