MATLAB: Infinite symsum returns symbolic number.

infinite limitsymsum

Hello, I would like to compute the following code:
syms n
x=0.5;
y=1.5;
f = (400/sinh(2*n*pi))*(((n*pi)*(1-(((-1)^n)*cos(1))))/((1-(n*pi)^2)^2))*(sin(n*pi*x).*sinh(n*pi*y));
%T= 273.15 + symsum(f,n,1,100);
T = 273.15 + symsum(f,n,1,inf);
When computing with a finite limit (like 100), it returns a single number.
but when computing with the infinite, it returns:
T =
5463/20 - 400*pi*symsum((n*sin((pi*n)/2)*sinh((3*pi*n)/2)*((1216652631687587*(-1)^n)/2251799813685248 - 1))/(sinh(2*pi*n)*(n^2*pi^2 - 1)^2), n, 1, Inf)
I have tried using vpa(T) to check the number, but it still returns a symbolic number with vpasum..
Can you let me know how to get a finite answer?
Thank you so much in advance!

Best Answer

I do not know why that happens, but do this for a workaround:
syms n
x=0.5;
y=1.5;
f = (400/sinh(2*n*pi))*(((n*pi)*(1-(((-1)^n)*cos(1))))/((1-(n*pi)^2)^2))*(sin(n*pi*x).*sinh(n*pi*y));
syms N positive
assumeAlso(N, 'integer');
f1 = subs(f,4*N-3);
f2 = subs(f,4*N-2); % is zero!

f3 = subs(f,4*N-1);
f4 = subs(f,4*N); % is zero!
fall = f1+f2+f3+f4;
%T= 273.15 + symsum(f,n,1,100);
T = 273.15 + vpa(symsum(fall,N,1,inf))
T = 
278.2575916829920971963474063102