Formal language inverse
What you're calling $w^{-1}$ is a special case of what's known as a homomorphism, where, informally speaking, we define a map $h$, from an alphabet $\Sigma$ to strings over an alphabet $\Gamma$ and then extend this in a natural way to maps of words. In your case, the map is particularly simple: $h(a)=b$ and $h(b)=a$. There's quite a bit known about such maps; for instance both regular and context-free languages are closed under homomorphisms.

(For what it's worth, your $ww^{-1}$ language isn't regular.)