Infinite symsum returns symbolic number.
조회 수: 6 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
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))
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!