I take advantage of mathematics a lot while programming, but in spite of that I'm very mathematically ignorant. Sorry if I'm asking something stupid.
Often I need to exponentially amplify some values. I usually start using exponentiation ($x^y$), but this gives me obvious problems whenever $x<0$.
What I would need is something similar to $|x|^y sgn(x)$: a function that amplifies $x \in \mathbb R$ (while keeping its sign) by an exponent $y \in \mathbb R^+$. (Possibly $|x|^{e^y} sgn(x)$ with $x,y \in \mathbb R$ would be even better)
Such function has no discontinuities and I find it easy to use and reason about.
I've got the feeling that amplifying a value exponentially is a very common use case when designing functions, and usually I realize that $x^y$ doesn't cut it only by trial and error.
This makes me wonder:
- Why a function as common and standard as $x^y$ has such a weird behavior for $x<0$?
I understand that $(-x)^2=(-x) \cdot (-x) = x^2$, but this definition only applies to $y \in \mathbb N$ anyways. Its extension to $y \in \mathbb R$ (and thus to $x<0$ too) could have been different.
And then:
- Does the function I'm looking for have a name?