Q:

Replace subexpression that appears as inverse too

I have
eq=Sqrt[(g m)/h] Tanh[Sqrt[h/(g m)] t]

then I am trying to replace Sqrt[m g/h] by a symbol v0. Obviously, the rule Sqrt[m g/h] -> v0 does only half the job as it does not replace inside the hyperbolic tangent with 1/v0. Is there a simple trick I am missing? Or do I have to spell it out explicitly by hand with a rule Sqrt[h/(mg)] -> 1/v0

A:

Try this:
 eq = Sqrt[(g m)/h] Tanh[Sqrt[h/(g m)] t] /. g -> v0^2*h/m // 
  Simplify[#, v0 > 0] &

(*  v0 Tanh[t/v0]  *)

Have fun!

