how to implement an infinite series?

6 ビュー (過去 30 日間)
Fatma Abdullah
Fatma Abdullah 2017 年 6 月 26 日
コメント済み: Fatma Abdullah 2017 年 7 月 12 日
im trying to implement the function in the attached image but i get that error "
Attempt to reference field of non-structure array.
at the step where (v) is being calculated. i dont know what it means and i dont know how to fix it
if true
clc;
close all;
N=32;
K=14;
c=0.8;
p=1;
pc=p*gamma(1+2/c);
T=399.01923099362968691492508329876;
s=T/(pc*(1+lambda);
syms i j f
nlambda = 50;
lambdavals2 = linspace(0,30,nlambda);
lambdavals = 10.^(lambdavals2/10);
for L = 1 : nlambda
lambda = lambdavals(L);
for i=K:N/2
w=nchoosek(N/2,i) %first series over i
z=arrayfun(@(j)nchoosek(K+i-1,j)*(-1)^(j),0 :K+i-1, 'uniform',0)%second series over j
v=symsum((-1)^(f)*(N+j-K-i+1)^(f)*gamma((f+1)*c/2)/(factorial(f)*(p*(T/(pc*(1+lambda))))^((f+1)*c/2)),i ,0, Inf)%third series over f
pd1temp=w*z*v
end
pd1 = c * K * nchoosek(N/2,K) * pd1temp; %the whole function
end
end
  27 件のコメント
Fatma Abdullah
Fatma Abdullah 2017 年 7 月 12 日
編集済み: Fatma Abdullah 2017 年 7 月 12 日
its T/[pc*(1+lambda)] and its the same in the image just a different way of writing ....i might have missed the parenthesis in the code
Fatma Abdullah
Fatma Abdullah 2017 年 7 月 12 日
and the value of T is not always 399 it could be any value >0 to thousands .....its calculated according to other equations mentioned in the paper

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

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 6 月 26 日
You have
i=13;
which assigns a specific numeric value to i . Then, a few lines later, you have
syms pfa1 i T j f
which overwrites i with a symbolic value, equivalent to doing
i = sym('i');
So now i is symbolic with no value other than itself, and has completely lost track of the fact it had previously been assigned 13.
Then later in your code you assume that i is still 13.
  7 件のコメント
Walter Roberson
Walter Roberson 2017 年 6 月 29 日
You asked for an infinite sum; that can potentially take a long time and a lot of memory unless convergence can be established.
That is why I have been asking the questions about the constraints: because knowing the constraints can make it much easier to establish whether something converges or not.
Fatma Abdullah
Fatma Abdullah 2017 年 7 月 3 日
N is always integer positive even number,so yes N is an integer that is a multiple of 2, k is required to be an integer positive between value>0 and N/2 and could be even or odd so the limits is ]0,N/2] , c is limited between value>0 and infinity including fractions and is required to be positive so the limits of c is ]0,inf[

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

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by