0

Evaluating the following expression results in a non-zero output

FullSimplify[Integrate[2 f[x], {x,0,1}] - 2 Integrate[f[x], {x,0,1}]]

I think the output should be zero, but do not know how to simplify this expression. Any suggestions ?

Sektor
  • 3,320
  • 7
  • 27
  • 36
  • Welcome! Without the actual definition for f[x], Mathematica will not be able to evaluate the expression. – Yves Klett Dec 26 '14 at 09:00
  • Interestingly, Integrate[2*f[x] - 2*f[x], {x, 0, 1}] is evaluated to 0, even without a definition for f[x]. – Shredderroy Dec 26 '14 at 09:14
  • Obviously, you did not give any attention at the expression. The definition for f is not needed. The above quantity MUST be zero. It is more than trivial. Mathematica does not simplify the expression and the question is "why"? – user23388 Dec 26 '14 at 09:17

2 Answers2

3

Use the Jens trick:

f /: Integrate[f[x_], x_] := if[x];
SetAttributes[if, {NumericFunction}];

And now

FullSimplify[Integrate[2 f[x], {x, 0, 1}] - 2 Integrate[f[x], {x, 0, 1}]]

(* 0 *)

You can read more about this in here

Nasser
  • 143,286
  • 11
  • 154
  • 359
0

For this particular case:

(Integrate[2 f[x], {x,0,1}] - 2 Integrate[f[x], {x,0,1}]) /. (Integrate[x_*f[h_], z_]) :> x* Integrate[f[h], z] 
Basheer Algohi
  • 19,917
  • 1
  • 31
  • 78