Group Abstract Group Abstract

Message Boards Message Boards

0
|
10.2K Views
|
4 Replies
|
1 Total Like
View groups...
Share
Share this post:

Summations in Mathematica

Posted 11 years ago

Does anyone know of a way that mathematica can solve the summation below. I understand you cannot use capital letter when defining variable, but this is just to demonstrate the basic idea I am getting at. I am trying to see what I can do and get away with in mathematica, so the variables may seem trivial.

These would be the defined sets

Subscript[X, 1, 1] = 1
Subscript[X, 1, 2] = 2
Subscript[X, 2, 1] = 3
Subscript[X, 1, 2] = 4
A[j] = {1, 2}
J = {1, 2}

enter image description here

POSTED BY: C McKinley
4 Replies
X = {{1, 2}, {3, 4}}
Sum[X[[i, j]], {i, 2}, {j, 2}]

will do as well

POSTED BY: Hans Dolhaine

If you want to sum over an irregular index set, you can first build the index set explicitly and then sum over it:

setA[j_] = {1, 2};
setJ = {1, 2};
indexSet = Flatten[Table[{a, j}, {a, setA[j]}, {j, setJ}], 1];
Sum[Subscript[X, Sequence @@ ij], {ij, indexSet}]
POSTED BY: Gianluca Gorni
POSTED BY: Sean Clarke
Posted 11 years ago
POSTED BY: C McKinley
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard