How to calculate this Sum :

2 visualizaciones (últimos 30 días)
HAli
HAli el 26 de En. de 2018
Comentada: HAli el 30 de En. de 2018
  1 comentario
Jan
Jan el 27 de En. de 2018
This is not "one" sum, but n different sums according to the index i. Do you want a numerical or symbolical summation? Please explain,what the inputs are, what you want as output and post the code you have tried so far.

Iniciar sesión para comentar.

Respuestas (3)

Torsten
Torsten el 26 de En. de 2018
Google "telescoping sum".
Best wishes
Torsten.
  1 comentario
HAli
HAli el 26 de En. de 2018
Hi thanks for your answer,but "telescoping sum"explain just a sum ,my problem is to solve a sum+another term!

Iniciar sesión para comentar.


Torsten
Torsten el 26 de En. de 2018
yes, add the other term to the value of the telescoping sum. What's the problem ?
In your case, your complete expression from above equals
l_(i)*(r_(i)+2*r_(i+1)) + r_(i)^2 - r_(n)^2
Best wishes
Torsten.
  10 comentarios
HAli
HAli el 28 de En. de 2018
I'm sorry Jan, but I try my best !!
you told me where the term came from: B0(i,j)=f_n+(1/3)*l_(i)(r_(i)+2*r_(i+1));*
Because these are the terms of my Matrix that I named B0 : its not just a sum,but a sum (from i to n-1) + another terme just depends on i
So,for the first term of the matrix B0, I have these terms analytically:
So,I changed the code another time, using your proposal:
B0=zeros(n,n);
for i=1:n
l(i)=0.042;
r(i+1)=r(i)+delta;
end
S=0;
for i=1:n
for j=i:i
for k=i:n-1
S = S+r(k)^2-r(k+1)^2;
B0(i,j)=S+(1/3)*l(i)*(r(i)+2*r(i+1));
B0(i+1,j)=-(S+(1/3)*l(i)*(r(i)+2*r(i+1)));
end
end
end
but this program is not correct because it doesn't sum up in a correct way,he had to make the sum of r(k)^2 -r(k+1)^2 from i (the value of i depends on the line i of the matrix) to n-1 (+) the second term which (1/3)*l(i)*(r(i)+2*r(i+1) depends just on the line i of the matrix.
For example,for line i =3 of the matrix B0:
it has to sum the r(k)^2 -r(k+1)^2 of i = 3 to n-1 and add the second term (1/3)*l(i)*(r(i)+2*r(i+1) just for i = 3
N.B:I changed the variable of the sum j by k because the matrix is always defined by i (the rows) and j (columns),
HAli
HAli el 30 de En. de 2018
is it always, I could not explain my problem!

Iniciar sesión para comentar.


HAli
HAli el 27 de En. de 2018
please I need help to implement this formula on Matlab!!! this is the script that I did but it doesn't work!!!! Any help!!

Community Treasure Hunt

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

Start Hunting!

Translated by