Here is a simple session with maxima, in which im trying to make the simplification (r-r0)=h
(%i1) ax: G*M*m*(r-r0)/r0^2 - G*M*m/r0 ;
G M m (r - r0) G M m
(%o1) -------------- - -----
2 r0
r0
(%i2) let(r-r0,h);
(%o2) r - r0 --> h
(%i3) expand(scanmap(letsimp,ax));
G M m r 2 G M m
(%o3) ------- - -------
2 r0
r0
I was expecting this in the last part:
G M m h 2 G M m
------- - -------
2 r0
r0
Why did maxima replace (r-r0) with r rather than with h? Iv attempted letsimp and letrat as instructed in this other question: common subexpressions