I can consider many possible reasons but could not come up with an answer
1) The part is actually expanded but somewhere it is being gathered again. Not likely, as my code does not override the gather function. 2) GiNaC thinks it cannot be expanded for some reason a) GiNaC refuses to expand due to restrictions on the depth of the tree? (not likely, the depth is too small) b) GiNaC refuses to expand cause it thinks the product may not be distributive? (likely, but i dont know) c) GiNaC thinks its an atom but the output fools me into believing it is not an atom?
I figured this out. The problem was with my understanding of the expand() behavior. I was expecting it to recurse until the expand no longer leads to any more expansion. Now I realize that not recursing should be the default and optimal behavior.