# Absolute ratios

I'm curious about the following idea:

suppose we have two values $P$ and $Q$, and the magnitude of the ratio $\frac{P}{Q}$ is between $0$ and $\infty$. If $P$ is smaller, then it's between $0$ and $1$. If $Q$ is smaller, it's between $1$ and $\infty$ (but the ratio $\frac{P}{Q}$ is between $0$ and $1$).

Is there a way to denote the "absolute ratio" (my term) that is always the ratio that is between $0$ and $1$ (either $\frac{P}{Q}$ or $\frac{Q}{P}$)?

As an example, the $\operatorname{absratio}(10,1) = \operatorname{absratio}(1,10) = 0.1.$

Because we're not supposed to start sentences with mathematical symbols, I'm presenting the answer this way: $$\displaystyle \min \biggl(\left\{\frac{P}{Q} ,\frac{Q}{P}\right\}\biggr).$$

• haha! just like (abs n: -n if n < 0 else n)...i prefer |n| – user62213 Feb 13 '13 at 21:23
• @user62213 Exactly, nice point. And by the way, you can introduce the notation you suggested in your question if you wish, you just need to explain what it is. – Git Gud Feb 13 '13 at 21:24

Here are a couple of candidates: $$\frac12\left(\frac PQ+\frac QP-\left|\frac PQ-\frac QP\right|\right)$$ and $$\frac{|P+Q|-|P-Q|}{|P+Q|+|P-Q|}$$

• I like the latter. – robjohn Feb 13 '13 at 21:43

I frequently find myself using this function. The prettiest statement, to my taste, is: $$absratio(A,B) = exp\{{|log(A)-log(B)|\}}$$

• You must 1/x this to get the value between 0 and 1. – Mark Melville Mar 20 '15 at 18:38

Cool! I'll build on Andrei B.'s and Mark Melville's comment (because otherwise I couldn't make nice notation),

I'm trying to use this to judge the similarity of aspect ratios of images regardless of scale - so 640:480 and 800:600 have an aspect ratio of 1.333 and the inverse orientation is .75. I'm thinking that these aspect ratios are not good for fair comparisons.

I like this function:

$$absratio(a, b) = \begin{cases} e^{(-|log(a)-log(b)|)}-1 & b \lt a \\ 1-e^{(-|log(a)-log(b)|)} & a \leq b \\ \end{cases}$$

which gives -0.11745 for 640:480, 800:600 and gives 0.11745 for 480:640, 600:800. $absratio_1 - absratio_2$ close to zero means that the ratios are close. So it's still absolute in the sense that it is symmetrical in an important way around 1:1, but it differentiates between 2:1 vs 1:2 as negative and positive. And if we really want only positive values, we can use regular old $abs()$ on that.

But is there a continuous representation of that piece-wise surface?? I would rather use that formula but I don't know how to do it.

Also, I don't know if I like all the properties of this function .. from 100:100 (or even 1:1) to 100:110 represents is an increase in area(?) of 10%. From 300:100 to 300:110 is also an increase in area of 10% but this function doesn't grow consistently for both. Could it?