Let u = l+d - x , then du = -dx and x = l+d -u
The integrand is then (l+d -u)(-du)/u and it breaks up into the integrals of -(l+d)du/u +du, which are
-(l+d)ln u + u
Substitute back for u and get -(l+d)ln (l+d-x) -x +l+d. The l+d after the -x drops out as it is not a part on the indefinite integral ( it is just some constant whose derivative is 0), so what's left is
-(l+d)ln (l+d-x) -x
Check: take the derivative --- -(l+d)(-1)/(l+d-x) -1 = (l+d-l-d+x)/(l+d-x) = x/(l+d-x)
How come the expression in brackets is different from what you have? BTW, what you have is the answer you also get from the Wolfram Integrator :-)
Are the two results the same? They both have the same derivative :-) :-), but l+d-x is not equal to -l-d+x.
True, but the point is rather subtle: the argument of the logarithm has to be positive and that can only happen if the argument is |l+d-x| (which is what it should have been written), positive for ANY value of x.
So, if x > l+d, the argument is x -(l+d). If x < l+d, the argument is l+d -x.
As I said, rather subtle.