What ComplexityFunction (or other technique) can I use to have Mathematica pull things out of fractions?

I have a rational function of several variables and I'd like to have Math'ca simplify, e.g.,

x(... + y(... + wz)) + ...


x(... + y(...)) + ....
---------------------- + w

? I've already told it that the relevant variables (in the denominator) are nonzero.

I was thinking of counting complexity as LeafCount plus the LeafCount of numerators, but I'm not sure how to do that.

  • 2
    $\begingroup$ Will Apart do what you want? $\endgroup$
    – murray
    Commented Apr 30, 2014 at 14:17

1 Answer 1


Murray's suggestion seems to work fine:

eqn = x (5 + a + y (6 + b + w z))/(x y z);

w + (5 + a + 6 y + b y)/(y z)

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.