Problem in summation with floor function

5 ビュー (過去 30 日間)
AVM
AVM 2020 年 6 月 23 日
編集済み: AVM 2020 年 6 月 24 日
I would like to compute the summation involving ''floor function'' as the limit of the sum. Below I have the code. But when I run that some error is apparing which is beyond my understanding. Please somebody help me to solve that issue.
" Error using symengine
Nonnegative integer or a symbol expected.
Error in sym/symsum (line 70)
rSym = mupadmex('symobj::map',fsym.s,'symobj::symsum',x.s,a.s,b.s);
Error in floorfu (line 43)
s23p=symsum(symsum(ss3p.*s2p,l,0,m),k,0,n);"
clc;
syms theta k l p q
W=1.0;
g=0.0001;
lm=0.1;
assume(k>=0);
assume(l>=0);
assume(p>=0);
assume(q>=0);
n=6;
m=6;
t1=floor((k+1)./2); %%%%%%%%%%%%% Floor fun
t2=floor(l./2);
theta=pi./3;
om=sqrt(((W).^2)-(4.*(g.^2)));
mu=sqrt((W+om)./(2.*om));
nu=((W-om)./(2.*g)).*mu;
eta=(((lm)./((2.*g)+W)).*(1+((W-om)./(2.*g)))).*mu;
tau= mu + nu.*cos(2.*theta);
d=k+l-2.*p-2.*q-2;
ag= eta.*cos(theta)./(sqrt(mu.*tau));
s1p=(mu./tau).*((-1).^m).*((1i)^(m+n)).*(2.*eta.*(mu-nu)./(sqrt(2.*mu.*nu))).^(m+n);
s2p=(((nu./2.*eta).*sqrt(mu.*tau)./(mu-nu)).^(k+l)).*factorial(k).*factorial(l).*nchoosek(n,k).*nchoosek(m,l).*exp(1i.*theta.*(k-l));
s3p= ((2./nu.*tau).^(p+q)).*factorial(2.*p + 2.*q +1 -k -l)./(factorial(p).*factorial(q)).*nchoosek(p,k-p).*nchoosek(q,l-q).*exp(-2.*1i.*theta.*(p-q)).*hermiteH(d,ag);
ss3p=symsum(symsum(s3p,q,t2,m),p,t1,n); %%%%%%%%% Actually in this line that error is coming
s23p=symsum(symsum(ss3p.*s2p,l,0,m),k,0,n);
sumout=s1p.*s23p
  8 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 6 月 24 日
For example, if you have a summation like this
following shows how to use symbolic toolbox or the sum() function using floating-point numbers
syms k
n = 10;
y = k^2*sin(k);
y1 = double(symsum(y, k, 1, n));
kv = 1:n;
y2 = sum(kv.^2.*sin(kv));
AVM
AVM 2020 年 6 月 24 日
編集済み: AVM 2020 年 6 月 24 日
Thanks for your reply. Okay, with this I must try.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by