I'm trying to get mathematica to replace an expression with a reduced form. I wanted to replace $(k/w)$ with $h$ in a particular expression, and I've tried something like:
form = (3 k)/w + (k^3 (1 + w)^3)/w^3 + (3 k^2 (1 + 2 w))/w^2;
y = FullSimplify[Collect[form /. k/w -> h, h]]
test = Collect[y, k]
When I do this, I get a partially reduced expression 'y'. If we look at 'test', output is
$3h + \frac{k^3(1 + w)^3}{w^3} + \frac{3k^2(1+2w)}{w^2} $
I would have thought Mathematica would have recast this as
$3h + h^3(1 + w)^3+ 3h^2(1+2w) $
but I'm having no joy. Any ideas how I can recast my equation in terms of $h$?
k -> w*h? There are similar questions about usingReplaceAllto perform algebraic substitutions. ButReplaceAllreplaces only matching expressions, and does no algebraic manipulation (like humans do when doing algebra). – Michael E2 Feb 27 '19 at 12:56