Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.
FullSimplify[Sqrt[1/(a^2 b^2)], Element[{a, b}, Reals]]

gives

Abs[1/(a b)]

How do I simplify the following expression

FullSimplify[Sqrt[(1 + a + b)/(a^2 b^2)], Element[{a, b}, Reals]]

into $\frac{\sqrt{a+b+1}}{\left| a b\right| }$ ?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

While LeafCount is not the complete ComplexityFunction used by Simplify it is a good first order approximation, and you can see that your expressions are equivalent under this metric:

expr1 = Sqrt[(1 + a + b)/(a^2 b^2)];
expr2 = Sqrt[a + b + 1]/Abs[a b];

LeafCount /@ {expr1, expr2}
{15, 15}

In your particular case merely using StringLength works:

FullSimplify[expr1, {a, b} \[Element] Reals, 
 ComplexityFunction -> (StringLength @ ToString @ # &)]
Sqrt[1 + a + b]/Abs[a b]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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