How to use symsum command for a function of two variables and two indices?

8 ビュー (過去 30 日間)
Sania Nizamani
Sania Nizamani 2022 年 7 月 17 日
コメント済み: Sania Nizamani 2022 年 7 月 18 日
Can anyone help to write a code in MATLAB for the expression given below:
I have tried with the following but it doesn't work: syms x y k1 k2 M_series=symsum(gamma(k1+1).*gamma(k2+1).*(x.^k1).*(y.^k2)./(factorial(k1).*factorial(k2).*gamma(k1+k2+1)),k1,0,Inf,k2,0,Inf);
  3 件のコメント
Sania Nizamani
Sania Nizamani 2022 年 7 月 17 日
You are right. I have made correction.
Torsten
Torsten 2022 年 7 月 17 日
So since factorial(k1) = gamma(k1+1) and factorial(k2) = gamma(k2+1), these terms cancel out and you are left with
sum_i sum_j 1/(i+j)! * x^i * y^j
Is this correct ?

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

採用された回答

Torsten
Torsten 2022 年 7 月 17 日
syms x y i j
assume(i,'integer')
assume(j,'integer')
A = symsum(symsum(x^i*y^j/factorial(i+j),i,0,Inf),j,0,Inf)
A = 
x0 = 0:0.2:1;
y0 = 0:0.25:1;
[x0,y0] = meshgrid(x0,y0);
[n,m] = size(x0);
for i = 1:n
for j = 1:m
A0(i,j) = double(subs(A,[x,y],[x0(i,j),y0(i,j)]));
end
end
surf(x0,y0,A0)

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by