# Integrate full derivative

I want mathematica to do

Integrate[D[f[x],x], {x,0,t}]


and achieve the answer f[t]-f. But Mathematica doesn't intergrate it.

Any ideas?

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Nov 24 '14 at 20:45
• Try with f[x_]:= Log@x .... – Dr. belisarius Nov 24 '14 at 20:49
• No problem in \$Version -> "8.0 for Microsoft Windows (64-bit) (October 7, 2011)". Integrate[D[f[x], x], {x, 0, t}] (* Out= -f + f[t] *) – Dr. Wolfgang Hintze Nov 24 '14 at 21:46
• I confirm that in v.8.0.4 Integrate[D[f[x],x], {x,0,t}] returns -f + f[t] but in v.10.0.1 it returns unevaluated. – Alexey Popkov Nov 24 '14 at 22:39

I'd use this nice method by Jens how to simplify symbolic integration (notice, need the SetAttributes for version 10)

Clear[f, ff];
f /: Integrate[f[x_], x_] := ff[x];
SetAttributes[ff, {NumericFunction}]
Integrate[f[x], {x, 0, t}] /. ff -> f • Actually, simply declaring f to be a NumericFunction is enough: Block[{f}, SetAttributes[f, {NumericFunction}]; Integrate[f'[x], {x, 0, t}]] – Michael E2 Apr 8 '17 at 21:58

Mathematica solves the equivalent differential equation:

y[t] /. First@DSolve[{y'[t] == f'[t], y == 0}, y, t]
(*
-f + f[t]
*)


Another approach is to add an assumption, in the form of an upvalue for the limit of f, that makes f continuous:

Block[{f},
f /: Limit[f[x_], x_ -> c_, ___] := f[c];
Integrate[D[f[x], x], {x, 0, t}]
]
(*  -f + f[t]  *)


It works because Integrate evaluates the antiderivative by means of directional limits at the end points. This observation, perhaps, indicates why Mathematica does not automatically apply the Fundamental Theorem of Calculus to the integral: It is not valid in all cases. In fact, the result above is not valid in all cases, since it yield zero for the following positive (and divergent!) integrand:

% /. f -> (1/(2 # - t)^2 &)
(*  0  *)


You could define the following substitution:

integrateByIndefiniteSub =
Integrate[arg_, {x_, xLow_, xHigh_}] :>
Subtract @@ (Integrate[arg, x] /. {{x -> xHigh}, {x -> xLow}} );


Usage:

Integrate[D[f[x],x], {x,0,t}] /. integrateByIndefiniteSub
(* Returns:   -f + f[t] *)


This method takes advantage of the fact that Mathematica can do the simplifications properly in an indefinite integral. It first evaluates the indefinite integral, and then subs in the bounds and subtracts.

However, when Mathematica can't antidifferentiate it, you end up with something unhelpful:

Integrate[g[x], {x, a, b}] /. integrateByIndefiniteSub
(* Returns:   -∫ g[a] d a  + ∫ g[b] d b  *)