how to implement an infinite series?

6 Ansichten (letzte 30 Tage)
Fatma Abdullah
Fatma Abdullah am 26 Jun. 2017
Kommentiert: Fatma Abdullah am 12 Jul. 2017
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 Kommentare
Fatma Abdullah
Fatma Abdullah am 12 Jul. 2017
Bearbeitet: Fatma Abdullah am 12 Jul. 2017
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 am 12 Jul. 2017
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 26 Jun. 2017
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 Kommentare
Walter Roberson
Walter Roberson am 29 Jun. 2017
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 am 3 Jul. 2017
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[

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by