Early on in my calculus education, I learned how to take the derivative of $x^x$ by re-writing it in the form $e^{x\ln x}$. More generally, this technique is helpful in finding the derivative of functions of the form $f(x)^{g(x)}$, where $f(x)$ and $g(x)$ are non-constant, positive, differentiable functions.
Now, as a teacher of calculus, I'm starting to ask why we care about such examples, and why we teach this "logarithmic differentiation" technique. Of course, computing derivatives is a fine end in itself, but one of the appealing aspects of calculus to most beginning students is that its techniques are saturated with application in engineering/physics/economics/etc. However, I don't think I've ever seen an application of a function of the form $f(x)^{g(x)}$ where neither $f(x)$ nor $g(x)$ are constant.
Has anyone ever seen such a function ($x^{2\sin^2 x+2}$, $(x^4+1)^{\frac{1}{x^2}}$, $\ldots$) arise in a suitably 'natural' way?
The geometric mean of the continuous interval $[a,x]$ (with $a > 0$) is $$GM(a,x) = \frac{1}{e} \left(\frac{x^x}{a^a} \right)^{\frac{1}{x-a}}.$$
Geometric means have applications in several areas, such as finance.
The derivation of this formula is a nice exercise in second-semester calculus. It can be done as an application of the integral, perhaps right after discussing the arithmetic mean of a function over a continuous interval and assuming you've discussed integration by parts (for the one place in the derivation where you need an antiderivative of $\ln x$). Divide the interval $[a,b]$ into $n$ equally spaced subintervals of width $\Delta x = \frac{b-a}{n}$, and calculate the discrete geometric mean using right endpoints as an approximation via $$\left(\prod_{i=1}^n (a + i\Delta x) \right)^{\frac{1}{n}} = \left(\prod_{i=1}^n (a + i\Delta x) \right)^{\frac{\Delta x}{b-a}}.$$ Taking the limit, we have \begin{align*}GM(a,b) &= \lim_{\Delta x \to 0} \left(\prod_{i=1}^n (a + i\Delta x) \right)^{\frac{\Delta x}{b-a}} \\ &= \exp \lim_{\Delta x \to 0} \ln \left(\left(\prod_{i=1}^n (a + i\Delta x) \right)^{\frac{\Delta x}{b-a}}\right) \\ &= \exp \left(\frac{1}{b-a} \lim_{\Delta x \to 0} \Delta x \sum_{i=1}^n \ln (a + i\Delta x) \right)\\ &= \exp \left(\frac{1}{b-a} \int_a^b \ln x \, dx \right)\\ &= \exp \left(\frac{1}{b-a} \left(x \ln x - x\right) \Big|_a^b \right)\\ &= \exp \left(\frac{1}{b-a} \left(b \ln b - b - a \ln a + a\right) \right)\\ &= \exp \left(\frac{1}{b-a} \left(\ln \frac{b^b}{a^a} \right) - 1\right)\\ &= \frac{1}{e} \left(\frac{b^b}{a^a} \right)^{\frac{1}{b-a}}. \end{align*}
Of course, one can generalize this to the geometric mean of a function $f(x)$ over a continuous interval, but the derivation gets nastier, as it requires antidifferentiating $\ln f(x)$.
From another point of view, the GM$(a,x)$ formula is a direct result of the fact that in product calculus, the product derivative of $\left(\frac{x}{e}\right)^x$ is precisely $x$. (The product derivative is effectively $\exp$ of the usual logarithmic derivative, so there's where you might care to know how to differentiate this function.) The geometric mean bears the same relationship to product calculus that the arithmetic mean does to the usual calculus. For more information, you can check out some notes on product calculus I wrote up several years ago or just do a search on the term.