# Sneg Library - Number operator simplify

I am trying to use the SNEG Library for evaluating some commutators. For instance I am trying to evaluate $$\left[n_1^2,a^\dagger_1\right]$$ with the code in Mathematica

<< sneg;
snegbosonoperators[a];
nSquare = (nc[number[a[1]], number[a[1]]]);
aCR1 = a[CR, 1];
Comm1 = komutator[nSquare, aCR1] // SnegFullSimplify


The result using SNEG is $$a_1^\dagger + 2 a_1^\dagger \cdot a_1^\dagger \cdot a_1$$.

However I would like to simplify it to $$a_1^\dagger + 2 a_1^\dagger \cdot n_1$$, automatically.

Is there any way to tell SNEG to simplify the expression in this way?

• You could write your own replacement rule, snegbosonoperators[n]; Comm1 /. nc[bef___, sym_[0, 1], sym_[1, 1], aft___] :> nc[bef, n[1, 1], aft]` – Jason B. Aug 8 '18 at 16:25
• Thank you! It's a good idea and it works. – Galuoises Aug 9 '18 at 9:17
• Anyhow how this could be generalized to the case of more operators, namely $n_1$, $n_2$, ... ? – Galuoises Aug 9 '18 at 9:22
• Sneg is a very nice QFT package. I had seen it many years ago and then forgotten it. I am glad you brought it up. Unfortunately it seems that it has not been maintained that much in the recent years. For example the documentation files, which seem quite good (see the "number" doc file for example ), are not directly accessible from the documentation center in version 11.3 . I have not tested older versions. Which version of Mathematica are you using? – magma Aug 16 '18 at 10:47
• I now try to contact the developer and see what we can do about it – magma Aug 16 '18 at 10:48