I have a series like this:

Sum[(n/z)^(1 - j + n)*Binomial[1 + n, j]*G[j], {j, 0, 1 + n}]/ ((1 + n)*(n/z)^n)


where G[j] is, at this stage, "some function", unspecified. n is usually pretty large and at some point I'll be truncating the series with an O(n+2) term at the end; but let's not go there just yet.

What I would like to see is, as you might expect:



Sum[((n/z)^(1 - j)*Binomial[1 + n, j]*G[j])/(1 + n), {j, 0, 1 + n}]

I can't see any way from getting from one to the other and get rid of the notion that simple rearrangements of terms are something that I ought to be able to do.

Can anyone point me in the right direction?


1 Answer 1

exp = Sum[(n/z)^(1 - j + n)*Binomial[1 + n, j]*G[j], {j, 0, 1 + n}]/((1 + n)*(n/z)^n); 

exp /. a_ Sum[x_, y___] :> Sum[a x, y]

Mathematica graphics

  • $\begingroup$ +1. Or perhaps exp /. a_ Sum[x_, y___] /; FreeQ[a, Alternatives @@ {y}[[All, 1]]] :> Sum[a x, y] for the cautious. (Or ! Internal`DependsOnQ[..] instead of FreeQ, but that might allow more than is desired; e.g. nested sums with the same index. While legal in M, no editor would probably allow it.) $\endgroup$
    – Michael E2
    May 31, 2015 at 14:12
  • $\begingroup$ Thank you @MichaelE2, for the vote and the caution. Didn't think about nested sums and possible dependence of a on indices. $\endgroup$
    – kglr
    May 31, 2015 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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