Can I define a relation between variables, such that the expression will also be evaluated (then assuming all indices are equal) when no index is given? $$ x_i + y_j = \delta_{ij} \stackrel{Mathematica\ recognizes \ then\ that}{\Rightarrow} x + y = \delta_{ii} = 1 $$ $$$$ $$$$

INITIAL QUESTION WAS: I define a relation for the annihilation and creation operator $a_i$ and $a_j$ like this $$[a_i, a_j^\dagger] = \delta_{ij}.$$

The commutator can be defined with the Quantum Notation package. I want to make the index ($i$, resp. $j$) optional, such that Mathematica recognizes that $$[a, a^\dagger] =1,$$ i.e. it assumes $i=j$ if no index is given. Is there a way to do this?

  • 3
    $\begingroup$ how do you currently define the relation? (for existing indices) $\endgroup$ Oct 4, 2013 at 6:35
  • $\begingroup$ showing us your code could make things easier $\endgroup$
    – Wizard
    Oct 4, 2013 at 15:39
  • $\begingroup$ Dear Wizard, Dear Pinguin Dirk, I actually define the relation exactly like this $$[a_i, a_j^\dagger] = KroneckerDelta[ij],$$ since the Quantum Notation package supports commutator notation. I just asked out of curiosity, in the moment I am using the "double definition" (one time with and one time without indices) as swish suggested. $\endgroup$
    – ahambi
    Oct 5, 2013 at 18:10

1 Answer 1


I have this package installed, so that's what I did, and everything worked:

enter image description here

  • 1
    $\begingroup$ Could you please 1) provide a link to the Quantum notation package and 2) edit in the real copyable code instead of the image? $\endgroup$ Feb 27, 2014 at 12:08

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.