# Simplify with function composition

I would like to write an expression of the form $$a/\sqrt{b c}$$ as $$a/d$$ where $$d = \sqrt{bc}$$. My hope was to use a similar strategy as when the square root is omitted:

Simplify[a/(b c), d == b c]


which yields a/d.

However,

Simplify[a/Sqrt[(b c)], d == Sqrt[b c], Assumptions -> {b > 0, c > 0}]


yields a/Sqrt[b c]. As shown, I tried specifying that b, c are positive, but this makes no difference. I have also tried FullSimplify.

I find the same behavior with Simplify[a/(b c), d == 1/(b c)] and Simplify[Exp[a]/(b c), d == Exp[a]], so there is clearly something going wrong when there is a composition, or when the right hand side of "==" is something other than Plus[blark, blah] or Times[blark, blah].

Does anyone see what I am missing here?

EDIT:

I should clarify, the use-cases I have are more complicated than the simple example above. As pointed out, the simple cases can be handled by TransformationFunctions. It is not clear this approach works for more complex expressions, such as

Simplify[Exp[a] (g + h)/Sqrt[(b c)], d == Exp[a] (g + h)/Sqrt[(b c)]]


which is more of interest.

• maybe something like Replace[HoldForm[a/Sqrt[b c]], HoldPattern[Sqrt[b c]] -> d, All]?
– kglr
Mar 17, 2021 at 23:41

You could try the following instead:

Simplify[a/Sqrt[b c], d^2==b c && d>0]


a/d

Your other examples can be handled by making use of TransformationFunctions, although I don't know how robust it would be for more complicated examples:

Simplify[
a/(b c),
TransformationFunctions->{ReplaceAll[b -> 1/(c d)], Automatic}
]


a d

Simplify[
Exp[a]/(b c),
TransformationFunctions->{ReplaceAll[a -> Log[d]],Automatic}
]


d/(b c)

• Thanks @Carl Woll and also @Nasser. This looks promising. What about expressions like Simplify[Exp[a]/Sqrt[(b c)], TransformationFunctions -> {ReplaceAll[a -> Log[(b c) d^2]/2], Automatic}]? This strategy does not appear to work... Mar 17, 2021 at 21:26

May be as a workaround

Simplify[a/Sqrt[b c], d^2 == (b c), Assumptions -> d > 0] 