Converting from Non-basis coordinates to XYZ. Solving system of equations. Error volume

98 Views Asked by At

I have multiple points in 3D space. Each point has the distances to 3 points. Those 3 points are:

  • (50,0,0)
  • (0,50,0)
  • (0,0,50)

Lets call those distances $dx,dy,dz$
I want to find $x,y,z$ of those points, altough I'm sure there are restritions. The system of equations is:
$$ (x - 50)^2 + y^2 + z^2 = dx^2$$ $$x^2 + (y - 50)^2 + z^2 = dy^2$$ $$x^2 + y^2 + (z - 50)^2 = dz^2$$

I started resolving it, but it was becoming too much long. So I used mathematica, and got this solution: $$root1 = -25000000 + 5000 dx^2 - dx^4 + 5000 dy^2 + dx^2 dy^2 - dy^4 + 5000 dz^2 + dx^2 dz^2 + dy^2 dz^2 - dz^4$$ There are two solutions, $(x1,y1,z1)$ and $(x2,y2,z2)$:

$$ x1 = \frac {1}{300} * \left(5000 - (2*dx*dx) + (dy*dy) + (dz*dz) - \sqrt{2} * \sqrt{root1} \right) $$ $$ y1 = \frac {1}{300} * \left(5000 + (dx*dx) - (2*dy*dy) + (dz*dz) - \sqrt{2} * \sqrt{root1} \right) $$ $$ z1 = \frac {1}{300} * \left(5000 + (dx*dx) + (dy*dy) - (2*dz*dz) - \sqrt{2} * \sqrt{root1} \right) $$

$$ x2 = \frac {1}{300} * \left(5000 - (2*dx*dx) + (dy*dy) + (dz*dz) + \sqrt{2} * \sqrt{root1} \right) $$ $$ y2 = \frac {1}{300} * \left(5000 + (dx*dx) - (2*dy*dy) + (dz*dz) + \sqrt{2} * \sqrt{root1} \right) $$ $$ z2 = \frac {1}{300} * \left(5000 + (dx*dx) + (dy*dy) - (2*dz*dz) + \sqrt{2} * \sqrt{root1} \right) $$

For some points both solution exist and are the same. But for others, root1 is negative, and therefore the solution doesn't exist. The problem is that those $dx,dy,dz$ infact exist, thats why I saved them, but I didnt save the exact values.
For example, to the point $(58, 73, 63)$ there is a solution, but for $(25, 44, 42)$ there is no solution. The real point that has a solution must be somewhere in a volume around that point.

My question is, how to find a close enough solution to an invalid point?

1

There are 1 best solutions below

0
On BEST ANSWER

What you do is you formulate an optimisation problem with the objective function resembling the residue (the "deviation") from an ideal solution. The usual choice here is $\|x-x_i\|_2 \stackrel!= d_i$ wich leads to the objectives $$(\|x-x_i\|_2 - d_i)^2$$ The square makes the function continuously differentiable (wich is nice) and the complete problem becomes $$\min_{x\in\mathbb R^n} \sum_{i=1}^3 (\|x-x_i\|_2 - d_i)^2$$ Wich is clearly $\ge 0$ and $= 0$ iff $\|x-x_i\|_2 = d_i$ for all $i$, i.e. iff $x$ is a perfect solution. Solving this problem can be done using convex optimisation machinery.