# Introducing Absolute Ratio

28 April 2012

Let's define the absolute ratio for positive numbers: When x is smaller than 1 return 1 / x, otherwise return x. Here are a few example values:
x abs_ratio(x)
0.5 2
2 2
0.2 5
5 5
And a graph: Another spelling for the same operator would take 2 positive numbers and give their absolute ratio: And a graph:

## Use case examples

• Music and audio - an octave of a frequency F is 2F. More generally a harmony of a frequency F is N*F where N is a natural number. To decide if one frequency is a harmony of another we just need to get their absolute ratio and see if it's whole. E.g. if abs_ratio(F1, F2) == 2 they're octaves. If abs_ratio(F1, F2) is whole - they're harmonies.
• Computer vision - to match shapes that have similar dimensions e.g. their width is only 10% larger or smaller. We don't care which is the bigger or smaller, we just want to know if 0.91 < W1 / W2 < 1.1 which may be easier to pronounce as abs_ratio(W1, W2) < 1.1
• Real life - when we see 2 comparable objects we're more likely to say one is "three times the other" vs "one third the other". Either way in our brains both statements mean the same concept. We think in absolute ratios.
• General case - When you want to know if X is K times bigger than Y or vice versa and you don't care which is the bigger one.

## Interesting Properties

• abs_ratio(Y / X) == abs_ratio(X / Y)
• log(abs_ratio(X)) = abs(log(X))
• log(abs_ratio(Y / X)) = abs(log(Y / X)) = abs(log(Y) - log(X))
• You can see from the above that absolute ratio is somewhat of an absolute value for log-space.

## What's next for absolute ratio

• I'd love to hear more use cases and relevant contexts.
• What would be the written symbol or notation?
• How can we get this operator famous enough to be of use to mainstream minds?
• About negative numbers and zero - right now that's undefined as I don't see a use case for that domain.
• For some code and graphs in python checkout https://github.com/ubershmekel/abs_ratio
EDIT - I'm growing to like the binary form of the operator more so from now on let's call it like this in python:
```def abs_ratio(a, b):
return a / b if a > b else b / a```