2

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

1 Answers1

2

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!

Alexei Boulbitch
  • 39,397
  • 2
  • 47
  • 96
  • Nice trick! I was hoping for something more automatic but I guess I could solve Sqrt[m g/h] == v0 for one of the variable and then use your trick. And maybe write some generic code to do that. –  Sep 03 '16 at 21:10