>>>it turns out that it provides
>correct answers in some cases
>only because of two canceling
>errors.
??<<
Start by remembering that the log function is only properly defined for positive real numbers. While there are various extensions to negative and complex numbers, none really work right. Using the typical principal value approach you end up with a function that is not a proper inverse to the exp function, and which does not satisfy the basic logarithmic identities (such as ln(ab)=ln(a)+ln(b)).
The proper general indefinite integral of 1/x is ln(kx), where k is a constant. For this to make sense, it is required that kx be real and positive. It is not required that k and x individually be so, nor have their logarithms defined (they could be negative, complex, or even physical quantities with units).
The form ln(|x|) is equivalent, for real x, to choosing k=1 for positive x and -1 for negative x. This form then works with no problems for an integral from a to b where a and b have the same sign. If a and b have different signs, then using that form is equivalent to using a different value of k (the constant of integration) for the two end points. This is an error, and introduces an error of πi in the result. But integrating from a to b with a and b having different signs means integrating over the singularity at zero. That is also an error, and introduces an error of πi. It turns out that the two errors cancel, so the form ln(|x|) gives the correct result integrating from a to b (a, b real) regardless of the signs of a and b. Hence the possible usefulness of this incorrect form.
__________________
� � � � Tom Gutman