Suppose I have an expression of the form:
expr=f[t]^b + f[t]^a g[t]^-a + g[t]^-c
And I want to create a rule to convert negative exponents to denominators. In the above example, this could be achieved manually as follows:
expr /. f[t]^a* g[t]^-a -> (f[t]/g[t])^a
$\left(\frac{f(t)}{g(t)}\right)^a+f(t)^b+g(t)^{-c}$
How would I achieve this with a general pattern match, independent of the identities of the bases and the exponents? In pseudocode, it would look something like this:
expr /. [some expression]^x*[some other expression]^-x ->
(some expression/some other expression)^x
I've made several attempts, without success.
Thus far, the only question I've been able to find on the subject is this, but the OP didn't specifically request a simple pattern-match replacement rule. Perhaps as a consequence, the answer is much more complicated than I'd like:
Display negative exponents always as fraction
Here's a related question, which seeks to do the opposite: