For example, I have the following expression :
A( 2 x1 + B(y1 + y2) + 2 x2 )
How do I make the output look like this (grouping (x1 + x2)
and (y1 + y2)
terms together) ?
2A (x1 + x2) + A B (y1 + y2)
I don't know why Simplify
doesn't group (x1 + x2)
together but just gives:
A (2 x1 + 2 x2 + B (y1 + y2))
I can use Collect
to get (y1 + y2)
after Simplify
but how about (x1 + x2)
?
Remember this is just a simple example, I would have a much more complicated terms involving (x1 + x2)
and (y1 + y2)
, so a method with no operation on the constants (2A
and A B
) would be great.