Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

Can anyone explain why Mathematica does not return a conditional expression that handles the case of p=-1 for Integrate[x^p,x]? Mathematica returns x^(1 + p)/(1 + p), which diverges for p=-1. In order for Mathematica to return Log[x], p must be set to -1 before the integration. Is there a subtle reason why this is actually correct behavior?

share|improve this question
Well, $\lim_{p\rightarrow -1} \frac{x^{p+1}}{p+1}=\ln(x)$. Not that mathematica knows this, though (try Limit[x^(1 + p)/(1 + p), p -> -1]) – acl Aug 29 '14 at 19:21
Oh yes, I had indeed noticed that the log was not recovered in the limit. – sm_physicist Aug 29 '14 at 19:30
Actually the log is recovered in the limit. It's just that mathematica doesn't recover it correctly. – acl Aug 29 '14 at 19:33
Indefinite Integrate returns a generically correct result. For a measure zero set of values in the parameter space it might not hold. One can get a "full" result using Integrate[t^p,{t,1,x}, Assumptions->x>1] (and taking a limit for the special case p->1, per other comments). – Daniel Lichtblau Aug 29 '14 at 21:03
I think the answer to this question has been given here. – Jens Aug 30 '14 at 1:09

With V10 one can see that the special case p = -1 is explicitly excluded:

FunctionDomain[Integrate[x^p, x], p, Reals]

enter image description here

Reason: The general formula

Integrate[x^p, x]

enter image description here

would result in a division by zero error with p = -1:

Limit[Integrate[x^p, x], p -> -1]

enter image description here

Integrating over a certain interval one gets the expected results:

Integrate[x^#, x] & /@ Range[-3, 3]

enter image description here

One might want to define:

xpp[x_^-1] := Integrate[x^-1, x]
xpp[x_^p_] := Integrate[x^p, x]



enter image description here



enter image description here

Another possibility:

Assuming[p == -1, Integrate[x^p, x]]

enter image description here

Assuming[p != -1, Integrate[x^p, x]]

enter image description here

share|improve this answer

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.