symsum does not return sum of series when a constant is replaced by symbol
11 ビュー (過去 30 日間)
古いコメントを表示
The following symbols are defined in my code:
syms l d z k positive;
assumeAlso(k,'integer');
assumeAlso(z,'integer');
assumeAlso(d,'integer'); assumeAlso(d<z);
When I try to find the sum of a series, symsum simply returns the input series itself. However, when I replace the variable z with a constant (say, 7), symsum returns the series sum as a hypergeometric function.
Series whose sum I want to find:
S = symsum(d.*(z-d).*l.^(k.*z+d)./(factorial(k.*z+d).*(k.*z+d)), k, 0, Inf)
Output:
S = -d*symsum(l^(d + k*z)/(factorial(d + k*z)*(d + k*z)), k, 0, Inf)*(d - z)
Replace z with 7:
S = symsum(d.*(7-d).*l.^(k.*7+d)./(factorial(k.*7+d).*(k.*7+d)), k, 0, Inf)
Output:
S = -(l^d*(d - 7)*hypergeom([1, d/7], [d/7 + 1, d/7 + 1, d/7 + 1/7, d/7 + 2/7, d/7 + 3/7, d/7 + 4/7, d/7 + 5/7, d/7 + 6/7], l^7/823543))/factorial(d)
From the output with z = 7, it is actually pretty clear what the series sum should be with z as a symbol. So, why doesn't symsum find it?
0 件のコメント
回答 (2 件)
Shiva Kalyan Diwakaruni
2021 年 5 月 3 日
編集済み: Shiva Kalyan Diwakaruni
2021 年 5 月 4 日
Hi,
MATLAB evaluates infinite sums by comparing them to a set of infinite sums for which it knows the answer. If MATLAB does not recognize the sum of a series, but sum is known to converge, a new pattern can be added with the sum::addpattern command (see https://www.mathworks.com/help/symbolic/mupad_ref/sum-addpattern.html). 'sum::addpattern' is a MuPad command, so the following syntax must be used to execute it in the MATLAB command line:
>> feval(symengine, 'sum::addpattern(f(n),n=-infinity..in
1 件のコメント
Walter Roberson
2021 年 5 月 4 日
None of the MuPAD internal functions are documented in any current release. You have to go back to about R2019a to find the documentation for them.
Walter Roberson
2021 年 5 月 4 日
S = -(l^d*(d - 7)*hypergeom([1, d/7], [d/7 + 1, d/7 + 1, d/7 + 1/7, d/7 + 2/7, d/7 + 3/7, d/7 + 4/7, d/7 + 5/7, d/7 + 6/7], l^7/823543))/factorial(d)
Yes, we can see the pattern,
S = -(l^d*(d - z)*hypergeom([1, d/z], [d/z + 1, d/z + 1, d/z + (1:z-1)/z], l^z/z^z))/factorial(d)
However... the Symbolic engine does not have any way to represent that. When we have a definite z value, we can write 1:z-1 but the symbolic colon operator can only operate when z is a known value because it wants to return an array of definite size
>> 1:z
Error using : (line 38)
Unable to compute number of steps from 1 to z by 1.
Symbolic colon is able to handle some other cases where the number of steps can be determined mathematically, such as
>> 0:z/8:z
ans =
[0, z/8, z/4, (3*z)/8, z/2, (5*z)/8, (3*z)/4, (7*z)/8, z]
The Symbolic Toolbox could probably be enhanced to return (for example)
symcolon(1,1,z-1)
for some new symcolon() operation... but it has not been. And it leads to questions that would take some thought to answer, such as what length() of a general symcolon() should be, or what should happen if you try to do something like run arrayfun() on this hypothetical symcolon() data structure.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!