4
$\begingroup$

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.$

$\endgroup$
4
$\begingroup$

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).$$

$\endgroup$
  • $\begingroup$ haha! just like (abs n: -n if n < 0 else n)...i prefer |n| $\endgroup$ – user62213 Feb 13 '13 at 21:23
  • $\begingroup$ @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. $\endgroup$ – Git Gud Feb 13 '13 at 21:24
3
$\begingroup$

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|} $$

$\endgroup$
  • $\begingroup$ I like the latter. $\endgroup$ – robjohn Feb 13 '13 at 21:43
3
$\begingroup$

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

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

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?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.