Maxima Function
factorout (expr, x_1, x_2, ...)
Rearranges the sum expr into a sum of terms of the form f (x_1, x_2, ...)*g where g is a product of expressions not containing any x_i and f is factored.
f (x_1, x_2, ...)*g
g
f