This question already has an answer here:
I have a horrid expression, which is basically a sum of exponents with coefficients. Here's a taste:
What I want to do is to replace
ks with another expression, but to do so only when
ks appears outside an exponent. Alternatively, I want to preform this replacement, but keep the arguments of all exponents unchanged.
For example I want
How would I do that?