How can I get exact analytical symbolic solution of a Cosine series from 1 up to nth harmonic?
3 次查看(过去 30 天)
显示 更早的评论
Hi, I am trying to solve for
syms n m d
m=2*n-1;
eqn1=symsum(1/m^2,n,1,Inf)
eqn = symsum(cos(m*d)/m^2,n,1,Inf)
I get the correct answer for sum of (1/m^2) equal to
eqn1 = pi^2/8
running that code. But when I try to get sum of cos(m*d)/m^2, it comes with the following expression even I assume and simplifiy it.
piecewise(in(d, 'real'), - exp(-d*1i)/2 - exp(d*1i)/2 + (exp(-d*1i)*hypergeom([-1/2, -1/2, 1], [1/2, 1/2], exp(d*2i)))/2 + (exp(d*1i)*hypergeom([-1/2, -1/2, 1], [1/2, 1/2], exp(-d*2i)))/2)
assume(d,'integer')
assume(d,'real')
assume(d<pi & d>-pi)
simplify(piecewise(in(d, 'real'), - exp(-d*1i)/2 - exp(d*1i)/2 + (exp(-d*1i)*hypergeom([-1/2, -1/2, 1], [1/2, 1/2], exp(d*2i)))/2 + (exp(d*1i)*hypergeom([-1/2, -1/2, 1], [1/2, 1/2], exp(-d*2i)))/2))
The simplified expression would be
pi^2/8(1-2*abs(d)/pi)
Can anyone suggest me whether is there any way to simplify the long piecewise equation into the above simple equation?
Any help is highly appreatiated.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!