0
$\begingroup$

I am doing the summation over two indices: m and n
Suppose I want to remove those terms from the summation which has m==n, what is the command for that? Because at m==n, terms are divergent.

I have already tried to do the summation in two cases:
m less than n and m>n.
But is there any other method to do it in one step?

$\endgroup$
0

3 Answers 3

3
$\begingroup$

Try also this:

    Sum[f[n, m] /. f[__] /; m == n -> 0, {n, 1, 3}, {m, 1, 3}]

(*   f[1, 2] + f[1, 3] + f[2, 1] + f[2, 3] + f[3, 1] + f[3, 2]  *)

The advantage is that if f[n,n]is divergent, Mma does not complain.

$\endgroup$
0
1
$\begingroup$

if the expression is not evaluated inside the Sum then you can try:

DeleteCases[Sum[f[n, m], {n, 1, 3}, {m, 1, 3}], f[i_, i_]]
(*f[1, 2] + f[1, 3] + f[2, 1] + f[2, 3] + f[3, 1] + f[3, 2]*)

if the expression is evaluated then try:

ind = DeleteCases[Tuples[Range[3], 2], {i_, i_}];
Total[f[#, #2] & @@@ ind]
(*f[1, 2] + f[1, 3] + f[2, 1] + f[2, 3] + f[3, 1] + f[3, 2]*)
$\endgroup$
0
$\begingroup$
Sum[f[n, m], {n, 3}, {m, n + 1, 3}] +  Sum[f[n, m], {n, 3}, {m, 1, n - 1}]
$\endgroup$
1
  • $\begingroup$ Thanks. This I have already tried (dividing into two cases). $\endgroup$
    – kphy
    Commented Dec 5, 2014 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.