How to calculate this Sum :

2 visualizzazioni (ultimi 30 giorni)
HAli
HAli il 26 Gen 2018
Commentato: HAli il 30 Gen 2018
  1 Commento
Jan
Jan il 27 Gen 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.

Accedi per commentare.

Risposte (3)

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

Accedi per commentare.


Torsten
Torsten il 26 Gen 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 Commenti
HAli
HAli il 28 Gen 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 il 30 Gen 2018
is it always, I could not explain my problem!

Accedi per commentare.


HAli
HAli il 27 Gen 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