I have been trying to work out how WolframAlpha derived this answer,
$$\int \log\left(x+\frac{1}{2}-\frac{\arctan\left(\tan\left(\pi\left(x+\frac{1}{2}\right)\right)\right)}{\pi}\right) {\rm d}x=x \log \left(x+\frac{\tan ^{-1}(\cot (\pi x))}{\pi }+\frac{1}{2}\right) + C$$ (1)
I have just started to read Paul Nahin's Inside Interesting Integrals, but I cannot see a way to proceed or even sketch out what I need to do.
Best Answer
Think about the graph of $ \arctan ( \tan (x)) $. For intervals with length $\pi$, it yields the graph of $ x + c $ for a some constant $c$. In fact, by doing some stretching and shifting (i.e. $\arctan(\tan(\pi(x+\frac12))$, you can convince yourself that $$ x + \frac12 - \frac{\arctan \left(\tan \left(\pi \left(x+\frac12 \right) \right) \right)}{\pi} \equiv \lfloor x \rfloor + 1 $$
and similarly, with some identities and some shifting around, that $$ x + \frac12 + \frac{\arctan (\cot (\pi x) )}{\pi} \equiv \lfloor x \rfloor + 1$$
So, the integral is now $$ \int \log(\lfloor x \rfloor +1 ) {\rm d} x. $$
Use integration by parts now with $ u = \log(\lfloor x \rfloor + 1),\frac{du}{dx} = \frac{0}{\lfloor x \rfloor + 1} = 0$ and $\frac{dv}{dx} = 1, v = x$.
$$ \int \log(\lfloor x \rfloor +1 ) {\rm d} x = x \log(\lfloor x \rfloor + 1) + C $$
which actually translates back to
$$ \int \log \left( x + \frac12 - \frac{\arctan \left(\tan \left(\pi \left(x+\frac12 \right) \right) \right)}{\pi} \right) {\rm d}x = x \log \left( x + \frac12 + \frac{\arctan (\cot (\pi x) )}{\pi} \right) + C $$
ta daa!