6
$\begingroup$

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?

$\endgroup$
7
  • $\begingroup$ 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]) $\endgroup$
    – acl
    Aug 29 '14 at 19:21
  • $\begingroup$ Oh yes, I had indeed noticed that the log was not recovered in the limit. $\endgroup$ Aug 29 '14 at 19:30
  • $\begingroup$ Actually the log is recovered in the limit. It's just that mathematica doesn't recover it correctly. $\endgroup$
    – acl
    Aug 29 '14 at 19:33
  • 6
    $\begingroup$ 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). $\endgroup$ Aug 29 '14 at 21:03
  • 1
    $\begingroup$ I think the answer to this question has been given here. $\endgroup$
    – Jens
    Aug 30 '14 at 1:09
5
$\begingroup$

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]

Now

xpp[x^-1]

enter image description here

and

xpp[b^2]

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

$\endgroup$
0

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .