How to calculate this Sum :

2 次查看(过去 30 天)
HAli
HAli 2018-1-26
评论: HAli 2018-1-30
  1 个评论
Jan
Jan 2018-1-27
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.

请先登录,再进行评论。

回答(3 个)

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

请先登录,再进行评论。


Torsten
Torsten 2018-1-26
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 个评论
HAli
HAli 2018-1-28
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 2018-1-30
is it always, I could not explain my problem!

请先登录,再进行评论。


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

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by