Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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]]



and not



share|improve this question
I think you mean Log[-x], not -Log[-x]. – Szabolcs Feb 6 '14 at 20:39
up vote 1 down vote accepted

-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] *)
share|improve this answer
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 ( 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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.