# Simplify fractions and square roots

I would like to 'Simplify'

Sqrt[5/6]/2


to

Sqrt[5/24]


I've tried to penalize Times and Rational using ComplexityFunction, but something like

mysim[e_] :=
100 (Count[e, _Times, {0, Infinity}] +
Count[e, _Rational, {0, Infinity}]) + LeafCount[e]


did not do work.

Suggestions are appreciated

• Mathematica brings some simple expressions to a canonical form. For example, 2/4 (i.e. Rational[2,4]) is immediately and automatically transformed to 1/2. Divide[a, b] is immediately transformed to Times[a,Power[b,-1]]. b+a becomes a+b. Such canonicalization aids equality testing. Similarly, Sqrt[5/24] immediately evaluates to Sqrt[5/6]/2. Thus Simplify can never return the former. Dec 9, 2015 at 10:48
• Ref: reference.wolfram.com/language/tutorial/… To maintain Sqrt[5/24] in its given form, Hold or HoldForm must be applied. I'm not commenting on whether that can be done with Simplify conveniently or whether it is worth doing, but it's likely not very simple to do. Dec 9, 2015 at 10:50
• Thanks Szabolcs, that put me on the way to an answer. Dec 9, 2015 at 19:20

ToSingleFractionForm[a_] := Block[{b}, b = a^2; Sign[a] Sqrt[TraditionalForm[b]]]