# Collecting terms in NCAlgebra

Let's say we have GP[v],GM[v]: two noncommutative objects depending on the commutative variable v.

<< NC;
<< NCAlgebra;
SetCommutative[v];
SetNonCommutative[GP, GM]
NCCollect[
GM[v] ** GP[3 v]/(30   v^4) + (243 v^4 GM[v] ** GP[3 v])/10   -
3 GP[v/3] ** GM[v] + GP[v/3] ** GM[v]/(30   v^4) + (
243 v^4 GP[v/3] ** GM[v])/10   - (82 GP[v/3] ** GM[3 v])/3   + (
3 GP[v/3] ** GM[3 v])/  (v^4) + (3 v^4 GP[v/3] ** GM[3 v])/  - (
82 GP[v/3] ** GP[v])/3   + (3 GP[v/3] ** GP[v])/  (v^4) +
3 v^4 GP[v/3] ** GP[v] - 3 GP[v/3] ** GP[3 v] + GP[v/3] ** GP[3 v]/(
30   v^4) + (243 v^4 GP[v/3] ** GP[3 v])/10   - (
82 GP[v] ** GM[3 v])/3   + (82 GP[v] ** GM[v] ** GP[v/3])/3   -
2 GP[v] ** GM[v] ** GP[v/3], {GP, GM}]


it returns the error : NCCollect::NotPolynomial: Could not transform expression into nc polynomial

I would like to collect it withGM[v]**GP[3 v], GP[v/3]**GM[v],GP[v/3]**GP[3 v], etc but without having to write all the terms by hand. How can I do that ?

Try adding the argument. For example, NCCollect[stuff,{GP[v/3],GP[v],GM[v]}]
The problem here is that the expression you have is not a valid NCPolynomial. You are dividing by - (82 GP[v/3] ** GP[v])/3 in one of your terms. If that is what you really want then you need to use inv instead. If that is just a typo then fine. But you will still have to add {GP[v/3],GP[v],GM[v]} as the argument to collect on as Mark S. pointed up above.