Message Boards Message Boards


Incorrect solution, how to control such behaviour of the Solve function?

Posted 1 year ago
3 Replies
5 Total Likes

Here is a simple system of algebraic equations. It is clear that two first equations determine x1 and x2 and the third one determines x3. But something goes wrong...

sys = {1 + x1^2,
  -3 + x2^2 + 4 x2*x1,
  -3 + x3 + x2*x1}

sol = Solve[sys == 0]
sys /. sol

Please look at the result here: notebook with this system. We see that there are 4 branch solutions and one of them is found with an error.

The question is about Solve, not about this particular system which, of course, can be solved after some manipulations (for instance, with help of Groebner, although it seems redundant in such a simple situation). In principle, Solve is able to correctly find solutions of much more complicated systems. What is wrong with this one and how to make control of such type of mistakes?

3 Replies

There is a bug in the code that generates solutions of triangular systems which affects cases that involve finding solutions of quadratics with complex coefficients. Should be fixed in the next release. As a workaround, you can disable the code by setting a couple of system options.

In[1]:= SetSystemOptions["ReduceOptions"->{                                   
           "UseNestedRoots"->False, "UseTriangularRoots"->False}];            

In[2]:= sys = {1 + x1^2, -3 + x2^2 + 4 x2*x1, -3 + x3 + x2*x1};               

In[3]:= sol = Solve[sys == 0]                                                 
Out[3]= {{x1 -> -I, x2 -> I, x3 -> 2}, {x1 -> -I, x2 -> 3 I, x3 -> 0}, 
>    {x1 -> I, x2 -> -I, x3 -> 2}, {x1 -> I, x2 -> -3 I, x3 -> 0}}

In[4]:= sys /. sol                                                            
Out[4]= {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}

We'll look into this.

Thank you very much for the explanation!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract