I'm learning to use the ReplaceAll function and I found the behavior of which is quite confusing.
For
Sqrt[f[x, y]] /. f[___] -> u Mathematica returns
Sqrt[u] However, if I replace f with Plus, i.e.
Sqrt[Plus[x, y]] /. Plus[___] -> u instead of returning Sqrt[u], Mathematica gives
u For
a*Sqrt[x] /. Sqrt[_] -> u Mathematica gives
a u However, if the input is
a/Sqrt[x] /. Sqrt[_] -> u Instead of returing a/u, Mathematica returns
a/Sqrt[x] I'm really confused. Can anybody shed some light on the behavior of this function?