I am trying to manipulate a Hamiltonian with non-commutative operators, $a_j,a_j^\dagger$. After some algebra using NCAlgebra package in Mathematica, I have an expression like, $$H = C_1 (b**a) + C_2 (a**a^\dagger) + C_3 (d^\dagger d) + \cdots $$ How do I extract/collect coefficients like $C_1,C_2$? I have tried NCCollect[H, b**a], but it does not give me the desired answer $C_1$? I am new to this and appreciate any help. Thank you.
$\begingroup$ $\endgroup$
3
NCCoefficientList[expr, {a, b}]? $\endgroup$Coefficient[expr, SuperStar[b1] ** b2]did the job. $\endgroup$