How can I get exact analytical symbolic solution of a Cosine series from 1 up to nth harmonic?

3 views (last 30 days)
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.

Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!