5
$\begingroup$

Why does this integration

Integrate[15-30x+6x^2-1/(x+5),x]

return 700 as integration constant? If we make a slight modification

Integrate[15-30x+6x^2-1/(x-5),x]

Mathematica provides desired result.

EDIT:
It turns out that the aforementioned modification gives the wrong answer, instead of $15x-15x^2+2x^3-\log(x-5)$ it gives $15x-15x^2+2x^3-\log(5-x)$ even in Rubi. Try these

Integrate[-1/(x-5),x]
Int[1/(x-5),x]

I think we should add 'bug' tag in this integration problem.

$\endgroup$
  • 1
    $\begingroup$ There is nothing incorrect with the 700. Differentiate the answer to check. (I assume you realize this.) Integrate does not promise to satisfy a particular initial condition, and one should not expect it to. $\endgroup$ – Michael E2 Oct 27 '14 at 1:58
  • $\begingroup$ Yes, but what about Integrate[-1/(x-5),x]? $\endgroup$ – Deco Oct 27 '14 at 2:09
  • 1
    $\begingroup$ Integrate[-1/(x-5),x] gives a correct answer, too. What's the problem? My point was that Mathematica does not specify the constant of integration, nor does it always give the simplest answer. The simplest one might be feasible, but it does not do it. All I think that you should be able to count on is that you get some antiderivative. If you don't, then it's a bug. If one needs the antiderivative to satisfy some condition, then the constant needs to solved for. $\endgroup$ – Michael E2 Oct 27 '14 at 2:26
  • $\begingroup$ i think it should be conditional expression, for $x \in (0,5)$ then $-\log(5-x)$ and for $x>5$ then $-\log(x-5)$. $\endgroup$ – Deco Oct 27 '14 at 2:59
  • 1
    $\begingroup$ Before we add "bug" tag, we should demonstrate the presence of a "bug". $\endgroup$ – Daniel Lichtblau Oct 27 '14 at 4:07
6
$\begingroup$

One has to look at code internals to find out. Most likely uncleared variable internally got stuck around. But since the result is still mathematically correct, one can't call this a bug. Strange, yes (why this integral and not others?), but still correct result.

But using Rubi Int instead of Integrate, there is no constant of integration:

Mathematica graphics

I recommend having Rubi package installed. I use it all the time, since it also shows the integration steps if needed which can be really useful sometimes.

$\endgroup$
5
$\begingroup$

It seems to me that the constant 700 is the result of the internal substitution x+5->t, needed for finding the Log.

Integrate[ 15 - 30 x + 6 x^2 - 1/(x + 5) /. x -> t - 5, t]

(* 315 t - 45 t^2 + 2 t^3 - Log[t] *)

Expand[%  /. t -> x + 5]

(* 700 + 15 x - 15 x^2 + 2 x^3 - Log[5 + x] *)

$\endgroup$

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