Different ordering for KroneckerDelta?

I have an expression like this:

Assuming[m [\Element] Integers && n [\Element] Integers, 1/2 I J n (4-m n+n^2) KroneckerDelta[m,-n]]//FullSimplify


Now, since KroneckerDelta has attribute Orderless, that means it will sort things into canonical order, and since my expression has $n^2$ in it, I assume that's why it's evaluating the Kronecker for m->-n (I tried putting KroneckerDelta[n,-m] but got the same result). Now, technically this is correct. But I'd like that my expression was given in terms of m, not n. If I manually replace n by -m I get the desired output

$$-iJm(2+m^2)$$

but I'd like to get that automatically within Mathematica. Is that possible without explicitly doing the replacement /.n->-m?

-

1 Answer

The order depends of alphabetical ordering of n and m. Therefore exist simple solution with renaming n and m

FullSimplify[1/2 I J m (4 - n m + m^2) KroneckerDelta[n, -m]] /. {n -> m, m -> n}


-
I guess that will do :) Thanks –  dingo_d Nov 24 '13 at 20:09
@dingo_d Since you've got more than 15 rep. you can upvote answers too. I'm just reminding because I see you've accepted answer with no upvote what is strange. –  Kuba Nov 24 '13 at 21:31
Oh, sometimes I totally forget to do that :S Sorry, upvoated it now ^^ –  dingo_d Nov 25 '13 at 8:24