Question: Integration rule to Maple int(1/x,x) = ln(abs(x))?

Hello

I'd like Maple to return ln(abs(x)) for int(1/x,x) instead of ln(x).

I tried convert MMA code,but I failed.

realIntegrate[f_, x_Symbol] := 
 Simplify[Integrate[f, x] /. Log[expr_] :> Log[Abs[expr]], 
  x \[Element] Reals]; Unprotect[Integrate]; 
Integrate[f_, x_Symbol] /; ! TrueQ[$flag] := 
 Block[{$flag = True}, realIntegrate[f, x]]; Protect[Integrate];

My maple code works only for very simple cases.

REALINT := proc (f, x)

if typematch(int(f, x), ln(y::anything), 's') then

`assuming`([simplify(ln(abs(rhs(s[1]))))], [x in real])

else int(f, x)

end if

end proc;

REALINT(1/x, x);

#ln(abs(x))

REALINT(1/(x+1), x);

#ln(abs(x+1))

REALINT(1/x+1, x);

#x+ln(x) dosen't work.

 

Thanks.

Please Wait...