I was doing this integral and wondered if the signum function would be a viable method for approaching such an integral. I can't seem to find any other way to help integrate the $|\sec \theta|$ term in the numerator of the integrand.
$$ \begin{aligned} \int \dfrac{\sqrt{x^2 + 1}}{x} \text{ d}x \ \ & \overset{x=\tan \theta}= \int \dfrac{\sqrt{\sec^2 \theta} \sec^2 \theta}{\tan \theta} \text{ d}\theta \\ & \ \ = \int \dfrac{|\sec \theta| \sec^2 \theta}{\tan \theta} \text{ d}\theta \\ & \ \ = \int \dfrac{\text{sgn} (\sec \theta) \sec^3 \theta}{\tan \theta} \text{ d}\theta \\ & \ \ = \text{sgn} (\sqrt{1+x^2}) \left( - \log \left| \dfrac{\sqrt{1+x^2} + 1}{x} \right| + \sqrt{1+x^2} \right) + \mathcal{C} \end{aligned} $$
It's clear that $\text{sgn} (\sqrt{1+x^2}) = 1$ since the sign of the argument of that function is always positive and the signum function extracts the sign. So I'd leave the integral as: $$ \begin{aligned} \int \dfrac{\sqrt{x^2 + 1}}{x} \text{ d}x = \log \left| x \right| - \log \left( \sqrt{1+x^2} + 1 \right) + \sqrt{1+x^2} + \mathcal{C} \end{aligned} $$
Would that be ok?
Also, apparently Wolfram has suggested that my final result should have $x$ as opposed to $|x|$ in the argument of the first logarithm. Why is that?
Any help would be greatly appreciated!