1

I am trying to solve a system of 6 non-linear equations for 6 variables but the notebook is continuously running for 2 days. What am I doing wrong? (Notebook attached)

exp1 = ExpandAll[(xd1 - x1)^2 + (yd1 - y1)^2 + z1^2 == h1^2];
exp2 = ExpandAll[(xd2 - x2)^2 + (yd2 - y2)^2 + z2^2 == h2^2];
exp3 = ExpandAll[(xd3 - x3)^2 + (yd3 - y3)^2 + z3^2 == h3^2];
exp4 = ExpandAll[((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)^(1/2) + ((x2 - x3)^2 + (y2 -y3)^2 + (z2 - z3)^2)^(1/2) == ((x1 - x3)^2 + (y1 - y3)^2 + (z1 - z3)^2)^(1/2)];
exp5 = ExpandAll[((z2 - z1)/(((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)^(1/2))) == ((z3 - z2)/(((x2 - x3)^2 + (y2 - y3)^2 + (z2 - z3)^2)^(1/2)))];
exp6 = ExpandAll[((z3 - z1)/(((x1 - x3)^2 + (y1 - y3)^2 + (z1 - z3)^2)^(1/2))) == ((z3 - z2)/(((x2 - x3)^2 + (y2 - y3)^2 + (z2 - z3)^2)^(1/2)))];

NSolve[{exp1, exp2, exp3, exp4, exp5, exp6}, {x1, y1, x2, y2, x3, y3}, Reals]
MNK
  • 634
  • 4
  • 18

1 Answers1

2

(Not an answer, but too long for a comment.)

Let xk, yk, zk define point Pk, then by the equality case of the triangle inequality exp4 means the three points P1, P2, P3 are collinear, with P2 between P1 and P3.

This is equivalent to P2 = a P1 + (1-a) P3 for some a ∈ [0,1], and in that case exp5 and exp6 follow, so the two last equations are redundant.

Then, the ratio a can be determined from the zk coordinates as a = (z3 - z2) / (z3 - z1). When the calculated a falls within the permissible interval [0,1], the remaining equations are:

  (xd1 - x1)^2 + (yd1 - y1)^2 + z1^2 == h1^2
  (xd2 - a x1 - (1-a) x3)^2 + (yd2 - a y1 - (1-a) y3)^2 + z2^2 == h2^2
  (xd3 - x3)^2 + (yd3 - y3)^2 + z3^2 == h3^2

This is a system of 3 equations with 4 unknowns {x1, y1, x3, y3}. In the general case, it can have none, several, or infinitely many solutions, though not necessarily pretty to calculate.

dxiv
  • 16,984
  • 2
  • 27
  • 49