フィルターのクリア

symsum and a divergent series

4 ビュー (過去 30 日間)
Dimitrios Anagnostou
Dimitrios Anagnostou 2023 年 2 月 9 日
コメント済み: Torsten 2023 年 2 月 14 日
I apologize if I'm asking something trivial.
I know that symsum can be used for series. For instance,
syms k
symsum(2^k/factorial(k),k,1,Inf)
ans = 
The series whose general term is is a divergent one. When I try symsum with this series I get
symsum(log(k+1)/k,k,1,Inf)
ans = 
Matlab return the series unevaluated. However, I wanted a behavior similar to Mathematica's.
Sum[Log[r + 1]/r, {r, 1, Infinity}]
% Output During evaluation of In[1]:= Sum::div: Sum does not converge.
Is it possible to get such an output from Matlab's Symbolic Math Toolbox? Thank you very much in advance!

採用された回答

John D'Errico
John D'Errico 2023 年 2 月 9 日
編集済み: John D'Errico 2023 年 2 月 9 日
Is it possible? Well, yes. And, sometimes, no.
But you can always use Mathematica. What else can I say?
When symsum returns a result that is the same as what you passed in, this is its way of telling you that no solution could be found, at least not by that tool. symsum does not always offer the ability to tell you a series is divergent, as opposed to merely not convergent.
In some cases of course, symsum has no problem. As you see here, symsum can at least some of the time return the result you want.
syms n
symsum(1./n,1,inf)
ans = 
That last sum is unbounded, greater than any finite number, so an INF. But next, symsum is smart enough to know the difference, for a classically problematic series.
symsum(sin(n),0,inf)
ans = 
NaN
Yes, that series is divergent, and MATLAB knew the sum is not unbounded, but that no value can be applied to the sum. So it returned NaN. to indicate the difference between an unbounded sum and one which can be only represented as NaN. But then we have this sum.
symsum(n,1,inf)
ans = 
DRAT. I could have sworn that Ramanujan proved the latter sum to be -1/12? Maybe I should send Ramanujan a letter pointing out that symsum disagrees? ;-) I would send it to G.H. Hardy of course, who might be able to forward it.
Anyway, that symsum fails to tell you a series was divergent is not always conclusive. It is only conclusive that symsum did not know the answer.
symsum(log(n+1)./n,1,inf)
ans = 
Computers are not omniscient. (Except when they play chess against me. Then they just laugh hysterically.)
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 2 月 9 日
編集済み: Dyuman Joshi 2023 年 2 月 10 日
An insightful answer, @John D'Errico

サインインしてコメントする。

その他の回答 (1 件)

Dimitrios Anagnostou
Dimitrios Anagnostou 2023 年 2 月 14 日
I accepted John D'Errico's thorough answer but to Matlab's defense I post also my answer. The problem was my typo. I have forgotten unfortunately the round brackets. c
syms k
symsum(log((k+1)/k),k,1,Inf)
ans = 
Matlab finds indeed that the series is a divergent one.
I apologize for any inconvenience caused.
  1 件のコメント
Torsten
Torsten 2023 年 2 月 14 日
But MATLAB should also show Inf as result for
syms x k
symsum(log(k+1)/k,k,1,Inf)
ans = 
But it doesn't.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by