Integral of $\int_{-\infty}^\infty \dfrac{\sigma}{(\sigma^2 + (x-\mu)^2)} \, dx$ I could use some help with this integration and/or an explanation of why Mathematica shows a different output.
The integral is:
$$\int_{-\infty}^\infty \dfrac{\sigma}{(\sigma^2 + (x-\mu)^2)} \,  dx$$
Here is my work:

Take $u = x-\mu$ so that $du = dx$. Then,
\begin{align}
    \int_{-\infty}^\infty \dfrac{\sigma}{\sigma^2 + (x-\mu)^2} \, dx
        &=
            \int_{-\infty}^\infty \dfrac{\sigma}{\sigma^2 + u^2} \, du
        \nonumber
        \\[.5em]
        &=
            \dfrac{1}{\sigma} \int_{-\infty}^\infty 
                \dfrac{1}{\dfrac{u^2}{\sigma^2} + 1}
            \,dx
        \nonumber
        \\[.5em]
        &=
            \dfrac{1}{\sigma} \tan^{-1} \left( \dfrac{u}{\sigma} \right) \bigg |_{-\infty}^\infty
        \nonumber
        \\[.5em]
        &=
            \dfrac{1}{\sigma} \left[ \dfrac{\pi}{2\sigma} + \dfrac{\pi}{2\sigma} \right]
        \nonumber
        \\[.5em]
        &=
            \dfrac{\pi}{\sigma^2}
        \nonumber
    \end{align}

When using evaluating the integral in terms of $u$, Mathematica agrees with my results. Although, when expanding $u$ out to be $x-\mu$, Mathematica says the answer is $i(\log(-i/\sigma)-\log(i/\sigma))$, which evaluates to $\pi$ for $\sigma>0$.
I'm a little confused by this. Any insight as to why this is so is appreciated, thank you.
 A: The answer is $\pi$. You made an error at the steps $$\dfrac{1}{\sigma} \int_{-\infty}^\infty \dfrac{1}{\dfrac{u^2}{\sigma^2} + 1} \,dx = \dfrac{1}{\sigma} \tan^{-1} \left( \dfrac{u}{\sigma} \right) \bigg |_{-\infty}^\infty = \dfrac{1}{\sigma} \left[ \dfrac{\pi}{2\sigma} + \dfrac{\pi}{2\sigma} \right]$$
It should be $$\dfrac{1}{\sigma} \int_{-\infty}^\infty \dfrac{1}{\dfrac{u^2}{\sigma^2} + 1} \,dx = \dfrac{1}{\sigma}\color{red}{\cdot \sigma} \tan^{-1} \left( \dfrac{u}{\sigma} \right) \bigg |_{-\infty}^\infty = \color{red}{1} \left[ \dfrac{\pi}{2} + \dfrac{\pi}{2} \right]$$
because the integral of $\frac{1}{\frac{u^2}{\sigma^2}+1}$ is $\sigma\tan^{-1} \left( \dfrac{u}{\sigma} \right)$, not $\tan^{-1} \left( \dfrac{u}{\sigma} \right)$ and because $\tan^{-1} \left( \dfrac{u}{\sigma} \right) \bigg |_{-\infty}^\infty$ doesn't depend on $\sigma$ (it will always be $\pi$).
Edit: As Winther pointed out, this is true only assuming that $\sigma>0$. For $\sigma=0$, the integral is $0$, and for $\sigma<0$, the integral is $-\pi$ instead of $\pi$.
