I am solving a commutator algebra in SymPy with the Hamiltonian
from sympy import*
a=Operator("a")
ad=Dagger(a)
b=Operator("b")
bd=Dagger(b)
H= ad*a + bd*b
Is there any way I can define commutation relations such as $[a,a^\dagger]=1$, $[b,b^\dagger]=1$ and $[a,b]=0$ ?
I want it such that if I calculate $[a,ad*b]$ I get $b$. There is a code in answer to one of the questions but it does not work in this case.