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 Center および File ExchangeConversion 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