sinkx的级数求和
这个是用欧拉公式得到的
e^(ix) = cosx + isinx
所以
coskx + i* sinkx = e^(ikx)
从1到n求和得
∑coskx + i∑sinkx = ∑e^(ikx) = [ e^(k+1)ix - e^ix ] / (e^ix - 1)
而 e^(ix) - 1 = e^(ix/2) [ e^(ix/2) - e^(-ix/2) ] =2i * e^(ix/2) * sinx/2
所以
∑sinkx
= Im [ e^(n+1)ix - e^ix] / (e^ix - 1)
= Im [ e^ix * (e^(inx)-1) / (e^ix-1) ]
= Im i * [e^(ix/2) * (1 - e^(inx)) / sinx/2 ] / 2
= Re [e^(ix/2) * (1 - e^(inx)) / sinx/2 ] / 2
= Re [ ( e^(ix/2) - e^(n+1/2)ix ) / 2sinx/2]
=[cos(x/2) - cos(n+1/2)x] / 2sin(x/2)