3
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| }$ ?

chyanog
  • 15,542
  • 3
  • 40
  • 78

1 Answers1

7

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]
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371