Infinite symsum returns symbolic number.

조회 수: 6 (최근 30일)
Jongan Park
Jongan Park 2020년 10월 19일
댓글: Jongan Park 2020년 10월 20일
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!

채택된 답변

Walter Roberson
Walter Roberson 2020년 10월 19일
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
Jongan Park
Jongan Park 2020년 10월 20일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jongan Park
Jongan Park 2020년 10월 19일
편집: Walter Roberson 2020년 10월 19일

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by