I was integrating a function and got something essentially like

E^(mu beta) * (1/beta)

There beta is defined as 1/(kT). I want to display the entire expression as

E^(mu beta) * (k T)

Is there a non-manual way to do that?


One useful trick is to precede the rule with an identity rule matching the part that you don't want to change. For example

E^(mu beta)*(1/beta) /. {u : mu beta -> u, beta -> 1/(k T)}
(* E^(beta mu) k T *)

This is obviously more useful in dealing with larger expressions


Not the answer you're looking for? Browse other questions tagged or ask your own question.