Introducing Absolute Ratio

28 April 2012

Let's define the absolute ratio for positive numbers: abs_ratio(x) = 1 / x when x < 1, otherwise: x 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: Absolute Ratio Graph Another spelling for the same operator would take 2 positive numbers and give their absolute ratio: And a graph: Absolute ratio in 3D

Use case examples

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

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