Consider the following two FullSimplify examples:
a^2 q^2 + q^4 c^2 // FullSimplify
q^2 (a^2 + c^2 q^2)
and
a^2 q^2 + q^4 (1 + c)^2 // FullSimplify
a^2 q^2 + (1 + c)^2 q^4
I would like the output of the second example to factor out the q^2 just like in the first example. Is there a way to make FullSimplify do that?
Note that the examples above are very simple just to illustrate the point. Ideally, I would like to apply the simplification to very large (rational) expressions that cannot be inspected visually.
Factorfor specific reasons? I am mentioning this becausea^2 q^2 + q^4 (1 + c)^2 // Factorfactors the desiredq^2term. – Jan 17 '22 at 03:56Factoris very limited. Even in this example, even though it factors outq^2it actually unfolds all other terms, which makes the expression less simplified overall. – Kagaratsch Jan 17 '22 at 04:09ExcludedFormsoptions ofFullSimplify? For example if you considerq^2an excluded form that is not to be touched.... – Jan 17 '22 at 04:14a^2 q^2 + q^4 (1 + c)^2 // Factor // FullSimplifygives the niceq^2 (a^2 + (1 + c)^2 q^2)which is of the form you're after. Not sure how much more complicated examples you want to consider. – Jan 17 '22 at 04:18q^2 Collect[expr2/q^2, q]whereexpr2 = a^2 q^2 + q^4 (1 + c)^2. – Syed Jan 17 '22 at 07:39