2

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

Paul
  • 21
  • 2
  • Factor[Sum[2*Subscript[f, m], {m, 1, q}]] does not factor either. – bbgodfrey Feb 08 '15 at 20:05
  • 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. – Bill Feb 08 '15 at 20:40
  • 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]. – Paul Feb 08 '15 at 20:57

1 Answers1

1

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]
bbgodfrey
  • 61,439
  • 17
  • 89
  • 156
  • +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 – Nasser Feb 08 '15 at 21:15
  • @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. – bbgodfrey Feb 08 '15 at 21:22