2
$\begingroup$

I'm VERY confused: in what universe is the following not zero?

FullSimplify[2*Sum[Subscript[f, i], {i, 1, q}] - Sum[2*Subscript[f, i], {i, 1, q}]]

Mathematica gives:

enter image description here

$\endgroup$
  • $\begingroup$ Factor[Sum[2*Subscript[f, m], {m, 1, q}]] does not factor either. $\endgroup$ – bbgodfrey Feb 8 '15 at 20:05
  • $\begingroup$ I believe that Mathematica does not do what you assume is "the mathematically mature thing" with "abstract" vectors or "abstract" sums, i.e. where the length of the vector or the bounds on the sum are symbols instead of specific concrete integer constants. $\endgroup$ – Bill Feb 8 '15 at 20:40
  • $\begingroup$ I guess not. On the other hand it is perfectly capable of dealing with the above if you replace f_i with, say Sin[i]. $\endgroup$ – Paul Feb 8 '15 at 20:57
1
$\begingroup$

FullSimplify and Simplify do simplification by applying a series of rules. Evidently, there is no rule for handling this case. If one is created by

t2[e_] := With[{ans = e /. Sum[Times[i_Integer , a___], b___] -> {i, a, b}}, 
   ans[[1]] Sum[Evaluate[ans[[2]]], Evaluate[ans[[3]]]]]

Then the desired simplification occurs.

FullSimplify[2*Sum[Subscript[f, m], {m, 1, q}] - Sum[2*Subscript[f, m], {m, 1, q}], 
 TransformationFunctions -> {Automatic, t2}]
(* 0 *)

Update (Thanks to Kuba)

Simplier is

t2[e_] := e /. Sum[Times[i_Integer , a___], b___] :> i Sum[a, b]
$\endgroup$
  • $\begingroup$ +1, nice. But I really think M should have done it without all this coding. Maple have no problem giving zero. screen shot !Mathematica graphics $\endgroup$ – Nasser Feb 8 '15 at 21:15
  • $\begingroup$ @Nasser My solution is, of course, quite rudimentary. The general solution would be to factor the summand and move each factor that is independent of the index outside the Sum. I agree that Mathematica's list of TransformationFunctions should include such a rule. $\endgroup$ – bbgodfrey Feb 8 '15 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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