1
$\begingroup$

I have some decent problems with performing a double summation. The Sum is as follows

Sum[ f[M[2, 1],M[2, 2]] , {M[2, 1], -Border, Border} , {M[2, 2], -Border, Border} ] 

over some function f, and this summation gives me the right result. However I want to generalize this thing in the following way

Sum[ Sum[ f[M[2, 1],M[2, 2]] , {M[2, i], -Border, Border}] , {i, 1, 2} ] 

which doesn't give me the right result and I cannot understand why. Can anybody tell me what is going wrong here and more importantly, how to make this generalized sum work?!

greets mike

$\endgroup$

2 Answers 2

0
$\begingroup$

I think what you need is

Sum[f[M[2, 1], M[2, 2]], Evaluate[Sequence @@ Table[{M[2, i], -Border, Border}, {i, 1, 2}]]] 
$\endgroup$
2
  • $\begingroup$ Thank you very much! This worked out for me! $\endgroup$ Commented Jul 24, 2019 at 12:10
  • $\begingroup$ You're welcome. The usual way of giving thanks on StackExchange is to up-vote an answer and to check the tick mark to accept an answer. $\endgroup$ Commented Jul 25, 2019 at 5:46
0
$\begingroup$

Perhaps

Fold[Sum[#, {m[2, #2], -b, b}] &, f[m[2, 1], m[2, 2]], {2, 1}] TexForm @ % 

$\sum _{m(2,1)=-b}^b \left(\sum _{m(2,2)=-b}^b f(m(2,1),m(2,2))\right)$

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.