I was reading a statistics paper and saw a formula with floor operators. I wondered how to solve for one of the variables in the formula, but realized that I did not know how to work with these things.
I have the following, where I am trying to solve for $a$.
$y = \lfloor log(a) – log(b) \rfloor + 1$
I am confused about the order of operations with the floor operators $\lfloor \rfloor$.
I see some options
- Ignore the floor and solve for $a$
$y = log(a) – log(b) + 1$
$y – 1 + log(b) = log(a)$
$a = exp[y – 1 + log(b) ]$
- Apply floor to each expression in the formula then use ceiling
$y = \lfloor log(a) – log(b) \rfloor + 1$
$y = \lfloor log(a) \rfloor – \lfloor log(b) \rfloor + 1$
$\lfloor log(a) \rfloor = y – 1 + \lfloor log(b) \rfloor$
$log(a) = \lceil y – 1 + \lfloor log(b) \rfloor\rceil$
$a = exp[\lceil y – 1 + \lfloor log(b) \rfloor\rceil]$
I could keep going with more I think, but I hope this gets the point across. I don't know how to do algebra with these ceiling and floor operators.
Best Answer
You have that $m = \lfloor{x}\rfloor$ if and only if $m \leq x < m + 1$. Thus, $$ y - 1 = \lfloor \log(a) - \log(b) \rfloor \implies y - 1 \leq \log(a) - \log(b) < y $$ and so we get $$ y - 1 + \log(b) \leq \log(a) < y + \log(b) $$ Exponentiating $$ be^{y - 1} \leq a < be^y $$ and so on...