I have two equations and two unknowns:
$R = \lfloor M * V\rfloor$
$N = \lfloor\frac{X - M}{R}\rfloor + 1$
$V$, $N$, $X$ are known. I need to solve for $R$ and $M$. I'm not sure how to handle the floor function.
|
I have two equations and two unknowns: $R = \lfloor M * V\rfloor$ $N = \lfloor\frac{X - M}{R}\rfloor + 1$ $V$, $N$, $X$ are known. I need to solve for $R$ and $M$. I'm not sure how to handle the floor function. |
|||||||||
|
|
Your equations imply that $R\le MV < R+1$ and $N-1 \le (X-M)/R < N$. Therefore, if $R$ can positive, the solution $(M,R)$ with $R>0$ can be any point inside the 2D region bounded by five straight lines: \begin{align} R &\le MV,\\ R &> MV - 1,\\ (N-1)R &\le X-M,\tag{1}\\ X-M &< NR,\tag{2}\\ R&>0,\tag{3}\\ \end{align} with the additional constraint that $R$ is an integer. If $R$ is allowed to be negative, the solution $(M,R)$ with $R<0$ can be found in the analogous way, with the inequality signs in $(1)-(3)$ flipped. |
|||||
|