I can't believe this hasn't been asked before but I can't find anything.
Is there a way to convince Simplify
or FullSimplify
to extract common factors from matrices as it does from sums?
Exhibit A:
{a/(2 c), b/(2 c), d/(2 c), e/(2 c)} // FullSimplify // FullSimplify
gives
{a/(2 c), b/(2 c), d/(2 c), e/(2 c)}
In reality, I have a 2x2 matrix, but the result is effectively the same. A solution to my problem should ideally not depend on the dimensions/layout of the (potentially nested) list.
Exhibit B:
a/(2 c) + b/(2 c) + d/(2 c) + e/(2 c) // FullSimplify
gives
(a + b + d + e)/(2 c)
I did see this related question, but I'm just asking about rearranging, I don't actually need access to the polynomial GDC in a separate variable or anything, so I was wondering if this was possible with Simplify
or FullSimplify
somehow.
{a,b,c} x
is not a "stable form", it would immediately evaluate to{a x, b x, c x}
. The question is interesting, I'm just mentioning that it's not possible to keep the expression in this form. You'd have to store{a,b,c}
andx
separately. $\endgroup$x+x
, which evaluates immediately to2x
, orSin[Pi]
which evaluates to0
. $\endgroup$PolynomialGDC
. Feel free to close as duplicate. $\endgroup$Hold[{a, b} x]
orHoldForm[{a,b} x]
, but held expressions aren't very suitable for algebraic manipulation.HoldForm
is useful though for just displaying the expression in certain form that is easier for us humans to parse. $\endgroup$