Why is "symsum" so slow?
>> syms k>> x2 = -.5:.5/1000:.5;>> fun(k) = exp(-((((k-1)*x2).^2)/.01));>> tic; p = symsum(fun(k),k,-1,1); toc; % almost 5 seconds
>> tic; p = fun(-1)+fun(0)+fun(1); toc; % about 1 second
performanceslowsumSymbolic Math Toolboxsymsumterms
>> syms k>> x2 = -.5:.5/1000:.5;>> fun(k) = exp(-((((k-1)*x2).^2)/.01));>> tic; p = symsum(fun(k),k,-1,1); toc; % almost 5 seconds
>> tic; p = fun(-1)+fun(0)+fun(1); toc; % about 1 second
Best Answer