I have a vector $x$, which I wish to transform according the the following computer code
xstar = sign(x) * x^2
with $x^*$ preserving the positiveness or negativeness of $x$.
How would I write this in proper mathematics? Obviously $x^2$ is incorrect, and $$x^*=\begin{cases} x^2 & \text{if } x \geq 0 \\ -x^2 & \text{if } x < 0 \end{cases}$$ is very clunky. Surely there must be something...