I feel there should be an easy solution to my problem but I couldn't find it.
I can explain my problem through a very simple example:
Given the functions f and a:
f := x(x-3) + 2x(x-3)
a := (x-3)
I now want to write f in terms of a which should be:
f = (x + 2x)a
or
f = 3xa
This is a very easy example, what I eventually want to do includes integrations of volumes.
I did find Mupad functions "Simplify" and "Rewrite" but I do not believe they can do what I want here. Is there a function in Matlab or a procedure that can do this automatically?