How to expand a summation with different indexes

1 次查看(过去 30 天)
How to expand a summation with different indexes like this?
Any help would be appreciated.
  4 个评论
Stephen23
Stephen23 2015-10-2
@SooShiant: Please stop posting the same question again and again.
SooShiant
SooShiant 2015-10-2
@Stephen Cobeldick
That was different. This is numerical but that one you deleted was symbolical. Don't you know the symbolical answer?

请先登录,再进行评论。

回答(4 个)

Thorsten
Thorsten 2015-10-2
sum(diff(f(1:4)).*n(1:3).*arrayfun(@(x) sum(m(x:end)), 3:5))
  7 个评论
Muthu Annamalai
Muthu Annamalai 2015-10-2
@Thorsten : nice solution exploiting fact that each sum is independent of the other index, i and j, we may use dot products to compute the inner loop, and repeat it again for index i. I wonder if there is also a way to do it with mesgrid() and matrix products.
SooShiant
SooShiant 2015-10-2
@Muthu Annamalai: don't you know the symbolical code?

请先登录,再进行评论。


Sean de Wolski
Sean de Wolski 2015-10-2
编辑:Sean de Wolski 2015-10-2
sum(diff(f(1:4)).*n(1:3).*sum(m(3:5)))
  5 个评论
Thorsten
Thorsten 2015-10-2
编辑:Thorsten 2015-10-2
Sean, yes, i is 1:3, so the starting index of j is 3:5, so the sum runs for j = 3:5 for i = 1, j = 4:5 for i = 2, and j = 5 for i = 3, i.e., assumes values sum(m(3:5)), sum(m(4:5)) and sum(m(5)) for i=1,2,3. You forgot to sum over the different m(j), as far as I can see.

请先登录,再进行评论。


SooShiant
SooShiant 2015-10-2
As I said I want a code to expand summation (algebraic) not to get a numerical answer. How bad is it. There is no way. May I need to try Mathematica. Can any one help with Mathematica?
  3 个评论
SooShiant
SooShiant 2015-10-2
I've seen this page before but as I said I'm new to matlab and need an emergency help. May you write down this code for me pleeeeeease??????????

请先登录,再进行评论。


SooShiant
SooShiant 2015-10-2
I need Matlab answer me:
I wonder how you experts can't writes such a simple code. May it relates to Matlab capabilities and should use Mathematica. Can anyone help with Mathematica?

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by