Euclidean division of a linear combination of real numbers

53 Views Asked by At

I have this following problem:

$T=nP_1 + mP_2$

With $T$, $P_1$ and $P_2$ real numbers. I have access to those three values, but is it possible to determine $m$ and $n$ ? This looks like the Bézout identity but with real values instead of integers. So would it be a generalization? I also know that $m$ and $n$ are integers between $0$ and $8$.

For context, I am looking at the neighbors of a cell in an array, so 8 surrounding cells with 3 values possible and I want to retrive from the total sum of the values the linear combination of $P_1$ and $P_2$. So I don't have to use several loops and if statements slowing down my program.

Thanks in advance for your answer!

1

There are 1 best solutions below

3
On

If T, P1 and P2 are totally random, there is generally no solution with n and m integers. Even without the limintation between 0 and 8.

If they are not random, and combinations of 2 well-known values, you have a system with 2 equations and 2 values.

Ex :

$T = 5 \times \sqrt{2}+\sqrt{3}$
$P1 = 6 \times \sqrt{2}+4 \times \sqrt{3}$
$P2 = 7 \times \sqrt{2}-\sqrt{3}$