1
$\begingroup$

I have an expression like this:

enter image description here

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?

$\endgroup$
2
$\begingroup$

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}

enter image description here

$\endgroup$
  • $\begingroup$ I guess that will do :) Thanks $\endgroup$ – dingo_d Nov 24 '13 at 20:09
  • $\begingroup$ @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. $\endgroup$ – Kuba Nov 24 '13 at 21:31
  • $\begingroup$ Oh, sometimes I totally forget to do that :S Sorry, upvoated it now ^^ $\endgroup$ – dingo_d Nov 25 '13 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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