Infinite symsum returns symbolic number.

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

Accepted Answer

Walter Roberson
Walter Roberson on 19 Oct 2020
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
  1 Comment
Jongan Park
Jongan Park on 20 Oct 2020
wow it is a very interesting approach. I dont know why and how that works.
I guess f2 and f4 are zero because the sin(n*pi*x) term goes zero.
Thank you so much for your help and time.
I was about to compromise with a summation to n=1000.

Sign in to comment.

More Answers (1)

Jongan Park
Jongan Park on 19 Oct 2020
Edited: Walter Roberson on 19 Oct 2020

Community Treasure Hunt

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

Start Hunting!