8
$\begingroup$

The following expression $$\int_{0}^{t} f(t_0) \,dt_0 - \int_{0}^{t} f(t_1) \,dt_1 = 0$$ is zero because it is just a change of integration variable.

Why doesn't Mathematica give zero in this case?

Integrate[f[t1],{t1,0,t}]-Integrate[f[t2],{t2,0,t}]
$\endgroup$
10
  • $\begingroup$ Maple gives zero simplify(int(f(t1),t1=0..t)-int(f(t2),t2=0..t)) gives zero. So I think you are right, Mathematica should give zero. I tried both Simplify and FullSimplify. !Mathematica graphics may be there a trick to make it simplify it to zero $\endgroup$
    – Nasser
    Commented Oct 31, 2023 at 11:21
  • $\begingroup$ Mathematically it is zero, I believe the logic just hasn't been implemented in mathematica $\endgroup$
    – Luca
    Commented Oct 31, 2023 at 11:34
  • $\begingroup$ You have to define what your f[x] is. Not all functions can be integrated, for example, Tan[x] is infinite when x=pi/2 $\endgroup$
    – I. C. Lin
    Commented Oct 31, 2023 at 11:36
  • 1
    $\begingroup$ I have an application with many nested integrals, and this behaviour is just a prerequisite so that I can calculate some results in high order perturbation theory. $\endgroup$
    – Luca
    Commented Oct 31, 2023 at 11:58
  • 3
    $\begingroup$ I agree. Mathematica understands many symbolic relations. The fact that an integral shouldn't depend on the name of the dummy variable should be fairly easy to spot. $\endgroup$ Commented Oct 31, 2023 at 12:16

3 Answers 3

5
$\begingroup$

You have to tell what your function is. Mathematica cannot output undefined values, for example, the integral result is infinite in some interval.

f[x_] := Tan[x];
Integrate[f[t1], {t1, 0, \[Pi]/2}] - Integrate[f[t2], {t2, 0, \[Pi]/2}]

And

f[x_] := Tan[x];
Integrate[f[t1], {t1, 0, \[Pi]/3}] - Integrate[f[t2], {t2, 0, \[Pi]/3}]

You can compare the 2 results.

$\endgroup$
2
  • 5
    $\begingroup$ "You have to tell what your function is. Mathematica cannot output undefined values"... this doesn't sound right? It can clearly turn f(x) - f(x) into 0 despite everything being undefined in that expression. $\endgroup$
    – user541686
    Commented Nov 1, 2023 at 7:23
  • 1
    $\begingroup$ I believe here Mathematica is correct and Maple is wrong - if f were a function such that the integral is infinite, the difference should be indeterminate, not zero. So one cannot just simplify it to zero without assuming the integral is finite. $\endgroup$
    – arkeet
    Commented Nov 5, 2023 at 19:20
5
$\begingroup$
FullSimplify[Integrate[f[t1], {t1, 0, t}] - Integrate[f[t2], {t2, 0, t}], 
 Assumptions -> t1 == t2]

(* 0 *)

Or if you encounter such situation mentioned in @Domen's comment:

expr = Integrate[f[t1], {t1, 0, t}] - Integrate[f[t2], {t2, 0, t}] + 
   t1 - t2;

expr /. Integrate[x_, {y_, z_, q_}] :> 
  Integrate[x /. y -> uniquename, {uniquename, z, q}]

(* t1 - t2 *)
$\endgroup$
1
  • 1
    $\begingroup$ Just a note, one has to be quite careful here because this doesn't take into account the correct local scoping of integration variables. Namely, FullSimplify[Integrate[f[t1], {t1, 0, t}] - Integrate[f[t2], {t2, 0, t}] + t1 - t2, Assumptions -> t1 == t2] will give 0 instead of t1 - t2. $\endgroup$
    – Domen
    Commented Oct 31, 2023 at 13:57
0
$\begingroup$

This can be grounded in such a way (of course, assuming the existence of the integral Integrate][f[t2], {t2, 0, t}]):

Activate[IntegrateChangeVariables[Inactive[Integrate][f[t2], {t2, 0, t}], t1, t1 == t2]]

Integrate[f[t1], {t1, 0, t}]

$\endgroup$

Your Answer

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

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