Message Boards Message Boards

0
|
4447 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

NSolve was unable to solve the system with inexact coefficients.

Posted 4 years ago

I am solving a system of 12 non-linear equations in 12 parameters, but Mathematica is throwing the titled error. I checked the variable names and equation consistencies but the error is still the same. What am I doing wrong?

xd1 = 0.0; yd1 = 0.0;
xd2 = -0.925; yd2 = 1.602147;
xd3 = -0.925; yd3 = -1.602147;
xd4 = 1.85; yd4 = 0.0;
L1 = 5.617283914628326; M1 = 0.8860216268743917; X1 = 1.337894783020567;
L2 = 5.654773750123332; M2 = 0.9805265966181068; X2 = 1.4832166403304003;
L3 = 6.916542880476896; M3 = 2.50791920413665  ; X3 = 3.4949269808743777;
L4 = 5.125638309808147; M4 = 2.3294103119493688; X4 = 3.2907496157385685;
z1 = 0.7665; z2 = 0.853; z3 = 1.33; z4 = 2.721; h=4.5;
eq1 = ExpandAll[(xd1 - xA)^2.0 + (yd1 - yA)^2.0 + h^2 - L1^2.0 == 0];
eq2 = ExpandAll[(xd1 - xB)^2.0 + (yd1 - yB)^2.0            - M1^2.0 ==
 0];
eq3 = ExpandAll[(xd2 - xA)^2.0 + (yd2 - yA)^2.0 + h^2 - L2^2.0 == 0];
eq4 = ExpandAll[(xd2 - xB)^2.0 + (yd2 - yB)^2.0            - M2^2.0 ==
 0];
eq5 = ExpandAll[(xd3 - xA)^2.0 + (yd3 - yA)^2.0 + h^2 - L3^2.0 == 0];
eq6 = ExpandAll[(xd3 - xB)^2.0 + (yd3 - yB)^2.0            - M3^2.0 ==
 0];
eq7 = ExpandAll[(xd4 - xA)^2.0 + (yd4 - yA)^2.0 + h^2 - L4^2.0 == 0];
eq8 = ExpandAll[(xd4 - xB)^2.0 + (yd4 - yB)^2.0            - M4^2.0 ==
 0];
eq9 = ExpandAll[(xd1 - xX1)^2.0 + (yd1 - yX1)^2.0 + z1^2 - X1^2.0 == 
0];
eq10 = ExpandAll[(xd2 - xX2)^2.0 + (yd2 - yX2)^2.0 + z2^2 - X2^2.0 == 
0];
eq11 = ExpandAll[(xd3 - xX3)^2.0 + (yd3 - yX3)^2.0 + z3^2 - X3^2.0 == 
0];
eq12 = ExpandAll[(xd4 - xX4)^2.0 + (yd4 - yX4)^2.0 + z4^2 - X4^2.0 == 
0];
NSolve[{eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10, eq11, eq12}, {xA, yA, xB, yB, xX1, yX1, xX2, yX2, xX3, yX3, xX4, yX4}, Reals]
POSTED BY: Neerav Kaushal
4 Replies
Posted 4 years ago

NMinimize the sum of the squares of the left hand side of your twelve equations quickly finds a reasonably small minimum. Perhaps casting your problem in terms of minimization will get you what you want.

POSTED BY: Bill Nelson

You should replace the exponents 2.0 with 2, so that it is an algebraic system instead of a transcendent system. However, you cannot solve this system exactly, as it is overdetermined. For example, eq1, eq3, eq5, eq7 are four circles that do not intersect all together:

ContourPlot[Evaluate[{eq1, eq3, eq5, eq7}],
 {xA, -8, 5}, {yA, -8, 5.5}]
POSTED BY: Gianluca Gorni
Posted 4 years ago

Actually i am looking for 6 coordinates on a straight line defined by these 12 parameters. I do not need exact value. They can be in a cylindrical volume around the line i wish to obtain. How can I involve small uncertainty in the answers so that i can get the values in +- of the actual values. The circles need not intersect but as you can see from the contour plots, they seem to intersect in a region but not at a single point. I want to find that region if an exact solution is not possible.

POSTED BY: Neerav Kaushal

No solution exist.

NSolve[Rationalize[{eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10,
    eq11, eq12}, 0], {xA, yA, xB, yB, xX1, yX1, xX2, yX2, xX3, yX3, 
  xX4, yX4}, Reals]
Reduce[Rationalize[{eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10,
    eq11, eq12}, 0], {xA, yA, xB, yB, xX1, yX1, xX2, yX2, xX3, yX3, 
  xX4, yX4}, Reals]
 Solve[Rationalize[{eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10, 
    eq11, eq12}, 0], {xA, yA, xB, yB, xX1, yX1, xX2, yX2, xX3, yX3, 
   xX4, yX4}, Reals, MaxExtraConditions -> All]
POSTED BY: Mariusz Iwaniuk
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract