Commutator algebra in quantum mechanics