# One more question about Assumptions and Integrate

There are many questions about assumptions here. Many of them are problem specific. That is why I want to ask a question in the most general way. Why does Mathematica solves this

Assuming[{x < 0}, Integrate[1/x, x]]


as

Log[x]


and not

-Log[-x]


?

-
I think you mean Log[-x], not -Log[-x]. – Szabolcs Feb 6 '14 at 20:39

-Log[-x] is not a correct result, but Log[-x] is.

In fact the expressions Log[-x] and Log[x] differ only in a constant I Pi, so both are correct antiderivatives for all $x \in \mathbb{C}$.

While the result given by Mathematica is correct, it is complex valued for x < 0. I think you are looking for a real valued result. I do not think it is possible to ask Integrate to automatically provide one.

For definite integrals this won't be a problem though as that complex constant is cancelled:

Integrate[1/x, {x, a, -1}, Assumptions -> a < -1]

(* ==> -Log[-a] *)

-
Yes, you are right about the minus sign, I forgot to move it under dx. However, I have one more question about the different part of your answer. Here (mathematica.stackexchange.com/a/41112/12223) you said "x > 0 is sufficient and (in Mathematica) implies that x is also real". So, does Mathematica assume x to be real or not? – shalabuda Feb 7 '14 at 13:18
@shalabuda Yes, x<0 is equivalent to x < 0 && Element[x, Reals]. It doesn't influence the result of the integral though. Log[x] is a correct result for all complex (real or not real) x. – Szabolcs Feb 7 '14 at 15:42
so, why does this Assuming[x \[Element] Reals, Re[Integrate[1/x, x]]] give Re[Log[x]] instead of Log[-x]? (sorry for asking these follow up questions, I'm trying to get an intuition of how Mathematica works) – shalabuda Feb 7 '14 at 16:13
Well, Re[Log[x]] is a correct answer to the question, right? If you'd like to simplify Re[Log[x]] to Log[-x] with the assumption that x<0, you can use FullSimplify[ComplexExpand@Re[Log[x]], x < 0]. – Szabolcs Feb 7 '14 at 16:40