4

The absolute value allows me to denote the difference between A and B regardless of which one is bigger, like so: $|A-B|$ or abs(A-B) in e.g. R.

I'm trying to correctly denote a formula where i do the same with division of two positive numbers (say, $C$ and $D$). Again, i don't care which one is bigger, but i want the resulting ratio to be between $0$ and $1$. So the intended answer is $C/D$ if $D$ is bigger, and its reciprocal if $C$ is bigger. When i code this in R i can simply do: ifelse(D>C,C/D,D/C).

But is there a way to denote my desired result in a mathematically more acceptable way? Thanks so much!

John Griffin
  • 10,668
  • How about $\min {D/C, C/D}$? – Guillermo Angeris Aug 18 '17 at 14:23
  • 1
    I like this question. We are indeed missing a function that returns the largest of a number and its inverse, implementable as $\exp(|\ln x|)$. –  Aug 18 '17 at 14:30
  • What about $|x|\bullet$ or $|x|\times$ or $|||x|||$ for the "absolute magnitude" ? –  Aug 18 '17 at 14:34
  • Thanks! Many ways to arrive at the answer using functions, none are wrong, but i was wondering about notation regardless of what a particular software might call functions like min{} or if() etc. @Yves Daoust: is your 2nd comment a universally accepted notation? (What does the dot mean?) – Marloes Eeftens Aug 18 '17 at 15:14
  • @MarloesEeftens: not at all. I have never met any notation for this. –  Aug 18 '17 at 15:33

3 Answers3

3

What about $$ \frac{\min\{C,D\}}{\max\{C,D\}}? $$

We can write $$ \min\{C,D\} = \frac{C+D-|C-D|}{2} \quad\text{and}\quad \max\{C,D\} = \frac{C+D+|C-D|}{2}, $$ so one could combine these two and only have addition, subtraction, division, and absolute values.

John Griffin
  • 10,668
2

I'll just add my comment as an answer:

How about $$ \min\left\{\frac{C}{D}, \frac{D}{C}\right\} $$ ?

The min/max functions are in R and this is perfectly mathematically acceptable since you note that $C,D > 0$.

1

Here's an approach that uses the sign/signum function:

$$\left(\frac{C}{D}\right)^{\text{sgn}(D-C)}$$

If $C>D$ then this gives $\left(\frac{C}{D}\right)^{-1}$

If $C=D$ then this gives $\left(\frac{C}{D}\right)^{0}$

If $C<D$ then this gives $\left(\frac{C}{D}\right)^{1}$

Χpẘ
  • 1,130
  • 6
  • 8