# How to explain the results of the following integrals?

Why does the following program lead to different results of a21 and a211?

moveconst[x_] := (x /. Integrate[factor_ expr_, {var_, min_, max_}] /;
FreeQ[factor, var] :> factor Integrate[expr, {var, min, max}]);

inta1 = 2 (2 Cos[q3[t]] fec1[x1] q5[t] - fe1[x1] Sin[q3[t]] );
a1 = Integrate[inta1, {x1, 0, L1}] q6[t];

inta2 = (4 Cos[q3[t]] fec1[x1] q5[t] q6[t] -2 fe1[x1] Sin[q3[t]] q6[t]);
a2 = Integrate[inta2, {x1, 0, L1}];

a21 = a1 - a2;
Simplify[a21, TransformationFunctions -> {Automatic, moveconst}]

inta11 = 4 Cos[q3[t]] fec1[x1] q5[t] - 2 fe1[x1] Sin[q3[t]] ;
a11 = Integrate[inta11, {x1, 0, L1}] q6[t];

inta21 = (4 Cos[q3[t]] fec1[x1] q5[t] q6[t] - 2 fe1[x1] Sin[q3[t]] q6[t]);
a21 = Integrate[inta21, {x1, 0, L1}];

a211 = a11 - a21;
Simplify[a211, TransformationFunctions -> {Automatic, moveconst}]

-
Constants get pulled out of indefinite integrals but do not get pulled out of definite integrals. One major reason for this is that definite integrals may not exist while indefinite ones do. – Searke Aug 22 '12 at 13:17

It looks like Simplify doesn't pull out numerical factors in certain integrals. A simple example being:

Simplify[Integrate[4 - 2 f[x], x] - 2 Integrate[2 - f[x], x]]


$\int (4-2 f[x]) \, dx-2 \int (2-f[x]) \, dx$

moveconst[x_] := (Map[Factor, x, -1] /.