1 | initial version |
You can work with elements of a polynomial ring instead of with symbolic expressions:
sage: R.<a,b,c> = ZZ[] # polynomials with integer coefficients, variables a, b, c
sage: (a*2+b*2).factor()
2 * (a + b)
sage: (a*c+b*c).factor()
c * (a + b)