Problem with symsum using infinity as the upper limit of the variable.
1 次查看(过去 30 天)
显示 更早的评论
I'm not sure if I'm using symsum correctly, why can't matlab give me an aswer when m is equal to infinity?
>> m=1000;
syms n;
x=[1 1/2 1/3 1/3*2 1/4 1/5 1/6 1/7];
a=symsum(((-(1./(2.^n)))*(x.^0)).*(abs(sign((round(n*x))-n*x))-1),n,1,m);
double (a')
ans =
1.0000
0.3333
0.1429
0.1429
0.0667
0.0323
0.0159
0.0079
>> m=inf;
syms n;
x=[1 1/2 1/3 1/3*2 1/4 1/5 1/6 1/7];
a=symsum(((-(1./(2.^n)))*(x.^0)).*(abs(sign((round(n*x))-n*x))-1),n,1,m);
>> a'
ans =
-conj(sum(1/2^n*(abs(sign(round(n) - n)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round(n/2) - n/2)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round(n/3) - n/3)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round((2*n)/3) - (2*n)/3)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round(n/4) - n/4)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round(n/5) - n/5)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round(n/6) - n/6)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round(n/7) - n/7)) - 1), n == 1..Inf))
I'd like to find a way to get the exact values for a, which should be:
1/1
1/3
1/7
1/7
1/15
1/31
1/63
1/127
0 个评论
回答(2 个)
Roger Stafford
2014-1-27
Tristan, you and I know the precise values of those infinite sums:
-conj(sum(1/2^n*(abs(sign(round(n) - n)) - 1), n == 1..Inf))
-conj(sum(1/2^n*(abs(sign(round(n/2) - n/2)) - 1), n == 1..Inf))
etc.
because we are intelligent human beings, but clearly in this case 'symsum' falls short of being able to do that. (I know a number of humans who would also not be able to succeed in that endeavor.) Where you gave m the finite value 1000, it must have painstakingly evaluated those expressions for each value of n to obtain an answer, but infinity proved too much for it. Perhaps one of these days Mathworks will revise 'symsum' to be smart enough to handle infinity in such a case. It is able to handle infinity in a number of other situations.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!