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!
$ x = \sinh u$
$$S = \int \frac{\sqrt{1+x^2}}{x}\mathbb{d}x = \int \frac{\cosh^2 u}{\sinh u }\mathbb{d}u = \int \Big\{\mathbb{csch}\ u +\sinh u \Big\}\mathbb{d}u \\ =-\ln\Big(\mathbb{csch}\ u +\mathbb{coth}\ u\Big)+\cosh u + C\\ $$
$$\cosh \sinh^{-1} x = \frac{1}{2}\bigg\{x+\sqrt{x^2+1} + \frac{1}{x+\sqrt{x^2+1}}\bigg\} = \sqrt{1+x^2} $$
$$S= \ln x +\sqrt{1+x^2} -\ln\Big(1+\sqrt{x^2+1}\Big)+C $$
Clearly it's simply a convenience to have $|x|$.