I test this sum of k^2*binomial(n,k)
The result is right for k in 0..n and k=1..n, isn't compute in 2..n, and is wrong from 3 to n.
I get 0 with Sage in 2..n.
(%i20) simplify_sum(sum(k^2*binomial(n,k),k,0,n));
2 n
(n + n) 2
(%o20) -----------
4
(%i21) simplify_sum(sum(k^2*binomial(n,k),k,1,n));
2 n
(n + n) 2
(%o21) -----------
4
(%i22) simplify_sum(sum(k^2*binomial(n,k),k,2,n));
n
====
\ 2
(%o22) > k binomial(n, k)
/
====
k = 2
(%i23) simplify_sum(sum(k^2*binomial(n,k),k,3,n));
2 n 2
(n + n) 2 - 8 n + 4 n
(%o23) ------------------------
4
Andrej Vodopivec
2011-04-24
Andrej Vodopivec
2011-04-28
Fixed in git:
(%i18) simplify_sum(sum(k^2*binomial(n,k),k,0,n));
(%o18) (n^2+n)*2^(n-2)
(%i19) simplify_sum(sum(k^2*binomial(n,k),k,1,n));
(%o19) (n^2+n)*2^(n-2)
(%i20) simplify_sum(sum(k^2*binomial(n,k),k,2,n));
(%o20) ((n^2+n)*2^n-4*n)/4
(%i21) simplify_sum(sum(k^2*binomial(n,k),k,3,n));
(%o21) ((n^2+n)*2^n-8*n^2+4*n)/4
Andrej Vodopivec
2011-04-28