$\mathrm{Abs}(a - b)$ is $b - a$ if $a - b < 0$ else $a -b$.
If so, is there anything equivalent for division? That is, something like:
$\mathrm{Xxx}(a/b)$ is $b/a$ if $a/b < 1$ else $a/b$.
Thanks.
$\mathrm{Abs}(a - b)$ is $b - a$ if $a - b < 0$ else $a -b$.
If so, is there anything equivalent for division? That is, something like:
$\mathrm{Xxx}(a/b)$ is $b/a$ if $a/b < 1$ else $a/b$.
Thanks.
One obvious formula for positive real $x$, equivalent to Asher2211's comment, is $$ f(x) = e^{|\log x|} = \begin{cases} \frac{1}{x} & 0 < x < 1, \\ x & 1 \leq x. \end{cases} $$ Conceptually, the natural logarithm $\log$ maps the positive reals to the reals (converting multiplication/division to addition/subtraction), the absolute value does its thing, and $\exp$ sends the value back to the positive reals (converting addition/subtraction back to multiplication/division).
This illustrates a useful general mathematical idiom, "transfer of structure".
This function can be extended to $f(x) = e^{|\log|x||}$, for non-zero real $x$, and $f(0) = 0$, i.e., $f(x) = 1/|x|$ if $0 < |x| < 1$ and $f(x) = |x|$ otherwise.