Hello sympt team!
While implementing second quantization in pymablock, @iarayad and I believe that we saw a bug in your implementation of group_by_operators, which influences the example https://qcode-uni-a.github.io/sympt/examples/I1_Transmon_resonator/ or any other Hamiltonian where $H_0$ isn't linear in boson number. In those cases, perturbation theory generates terms like $a^\dagger (a^\dagger a + x)^{-1} a$. group_by_operators will process this term as $a^\dagger a: (a^\dagger a + x)^{-1}$, which is incorrect because the energy denominator does not commute with $a$. Because group_by_operators is used in all examples as a way to examine the results, it seems like a serious issue.
To be able to manipulate expressions with energy denominators, where normal ordering does not work, and also to be able to use sympy simplification routines with operator expressions, we developed a number ordering scheme. Please find its implementation over here:
https://github.com/quantum-tinkerer/pymablock/blob/745a68291e5ae5c1c6c4a1bbfad73c70cf26a20c/pymablock/second_quantization.py#L64-L327
Hello sympt team!
While implementing second quantization in pymablock, @iarayad and I believe that we saw a bug in your implementation of$H_0$ isn't linear in boson number. In those cases, perturbation theory generates terms like $a^\dagger (a^\dagger a + x)^{-1} a$ . $a^\dagger a: (a^\dagger a + x)^{-1}$ , which is incorrect because the energy denominator does not commute with $a$ . Because
group_by_operators, which influences the example https://qcode-uni-a.github.io/sympt/examples/I1_Transmon_resonator/ or any other Hamiltonian wheregroup_by_operatorswill process this term asgroup_by_operatorsis used in all examples as a way to examine the results, it seems like a serious issue.To be able to manipulate expressions with energy denominators, where normal ordering does not work, and also to be able to use sympy simplification routines with operator expressions, we developed a number ordering scheme. Please find its implementation over here:
https://github.com/quantum-tinkerer/pymablock/blob/745a68291e5ae5c1c6c4a1bbfad73c70cf26a20c/pymablock/second_quantization.py#L64-L327