2
$\begingroup$
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| }$ ?

$\endgroup$
6
$\begingroup$

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]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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