Consider the following two polynomials:

f1[t_] := t^3 - 1
f2[t_] := t^3 + 3t - 1

Both of these polynomials have a single real root: $f_1(t)$ at $t = 1$, and $f_2(t)$ at $t \approx 0.322$. Both also satisfy $f'(t) > 0$ at all points in the interval. Let's now try to do the integrals $$ I_1 = \int_0^x \frac{f_1'(t)}{f_1(t)^2} dt \qquad \text{and} \qquad I_2 = \int_0^x \frac{f_2'(t)}{f_2(t)^2} dt $$ for each of these polynomials. (The closed-form indefinite integrals exist in both cases and are $-1/f_1$ and $-1/f_2$ respectively.) We obtain:

integral1 = Integrate[D[f1[t],t] / f1[t]^2, {t, 0, x}]

(* ConditionalExpression[3 (-(1/3) + 1/(3 - 3 x^3)), Re[x] <= 1 || x ∉ Reals] *)

integral2 = Integrate[D[f2[t], t] / f2[t]^2, {t, 0, x}]

(* -1 + 1/(1 - 3 x - x^3) *)

For the first integral, Mathematica correctly recognizes that the integral only converges if $x < 1$. However, it does not seem to be able to recognize that the second integral only converges if $x \lesssim 0.322$.

Is this a bug? Is there a way to tell Integrate to apply additional transformations that might lead it to recognize the conditional convergence of $I_2$ in the same way that it does for $I_1$?

To show that this could lead to unexpected behavior, note that if we set x -> 2 in the above integrals we get

integral1 /. x -> 2

(* Undefined *)  

integral2 /. x -> 2

(* -(14/13) *)

But the integrand of $I_2$ is manifestly positive, and it shouldn't be possible to integrate a positive function to get a negative number. Obviously this is due to the extension of this integral past its domain of applicability; it would be nice if we could somehow modify Mathematica's behavior to tell us that we've done so in both of these cases, not just the case of $I_1$.

I am running Mathematica 10.4.1 on Mac OS X.

  • $\begingroup$ This question was inspired by this question over on Math StackExchange. $\endgroup$ May 15, 2017 at 18:30
  • $\begingroup$ If you take a complex path around the singularity, it seems to work: Block[{x = 2.}, {NIntegrate[D[f2[t], t]/f2[t]^2, {t, 0, I, x + I, x}], -1 + 1/(1 - x (3 + x^2))}] -- Oddly, adding assumptions that x is real leads to the condition x > 0. $\endgroup$
    – Michael E2
    May 15, 2017 at 19:07
  • $\begingroup$ Presumably any polynomial which does not obviously factor will have that problem... $\endgroup$
    – Igor Rivin
    May 16, 2017 at 3:37


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.