# Collect with symbolic exponents does not simplify any further

I am trying to simplify a symbolic expression. Here is an example:

f1[x_] := (2/x) (c/x)^(\[Gamma] - 1);
f2[x_] := 1 - 2/x (1 + f1[x] + f1[x]^(-\[Theta]))
Collect[f2[x], x^_]


The result is this:

But this can still be further simplified, for example: in the second term on the fraction, the exponents gamma and theta are not combined, and the x in the denominator is also ignored. How can I automate a further simplification?

• Please update the post with the desired result as expressions can take many forms. Thanks.
– Syed
Jan 13, 2023 at 15:41

You need to apply some appropriate assumptions, and force FullSimplify into preferring fewer xs:

Collect[
FullSimplify[
#,
γ∈Reals&&c>0&&x>0,
ComplexityFunction->(
LeafCount[#1]+Count[#1,x,All]&
)]&/@
ExpandAll[f2[x]],
x^_
]


Clear["Global*"]

f1[x_] := (2/x) (c/x)^(\[Gamma] - 1);
f2[x_] := 1 - 2/x (1 + f1[x] + f1[x]^(-\[Theta]))

f = Collect[f2[x], x];


What if anything do you know about the sign of c and/or x?

ReplacePart[
Join[{
{Assumptions, FullSimplify}, {None, FullSimplify@f}},
{#, FullSimplify[f, #]} & /@
Join[
{c > 0, x > 0, c < 0, x < 0},
Tuples[{{c > 0, c < 0}, {x > 0, x < 0}}]]],
{{-1, -1} -> SpanFromAbove,
{6, -1} -> SpanFromAbove}] //
Grid[#, Frame -> All,
Alignment -> {Center, Center}] &
`