2
$\begingroup$

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:

enter image description here

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?

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

2 Answers 2

6
$\begingroup$

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^_
 ]

enter image description here

$\endgroup$
5
$\begingroup$
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}] &

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.