I know that I can use collect to "factor out" a variable or arrange a symbolic expressions in powers of that variable.
But if there's a term, e.g. x+1, as common factor, I don't know how to factor it out. collect doesn't work for this, e.g.:
sage: var('c0 c1 c2 x0 x1 x') sage: (c0 * (x+1) + c1(x+1) + c2c1x - c0c1(x+1)).collect(x+1) output: -c0c1(x + 1) + c1c2x + c0(x + 1) + c1*(x + 1)
What I would like to have here is: (-c0c1 + c0 + c1)(x + 1) + c1c2x