Does symsum in Matlab do more than it should?

290 views Asked by At

I have the following loop

syms k m
summ = symsum(k^2,k,1,m)
for j=1:100
  summ = subs(symsum((m-j)^2*summ,m,j+1,k),k,m);
end

and it takes about 600s to calculate it on R2014a, W7, 64b. An equivalent calculation in Mathematica takes 60s. The result is identical but there is a difference. One of the properties of all sums (in this case all one hundred of them) is that it can be factorized in a semi-nice way. Mathematica does not factorize it by default because it is not told to do so. But symsum does it by checking the sums and that, I think, is the source of a slowdown.

Would you agree? If yes, is there a way to tell symsum to not simplify the output? If no, is there a way so speed it up? I really would like to do it in Matlab than in Mathematica.

0

There are 0 answers