1. 鍦∕ATLAB涓,symsum锻戒护濡备綍浣跨敤锛
鍦∕ATLAB涓锛宻ymsum鏄姹傚拰锻戒护銆
浣跨敤渚嫔瓙锛
syms k n
symsum(k) % k^2/2 - k/2
symsum(k,0,n-1) % (n*(n - 1))/2
symsum(k,0,n) %(n*(n + 1))/2
simplify(symsum(k^2,0,n)) %n^3/3 + n^2/2 + n/6
symsum(k^2,0,10) %385
symsum(k^2,[0,10]) %385
symsum(k^2,11,10) % 0
symsum(1/k^2) %-psi(k, 1)
symsum(1/k^2,1,Inf) % pi^2/6