0
$\begingroup$

I am alarmed by the behavior of Mathematica (9.0) when given the following simple set of equations to solve:

eq = {1 + x^3 - 5*x*y + y^3 == 0, 
      3 - 5*x*y + ((1 + I*Sqrt[3])*(-5*x + 3*y^2))/2 == 0}

Solve[eq] gives the 4 solutions correctly.
Solve[eq,{x,y}] results in the message

Roots::neq: 0 is expected to be a polynomial in the variable x.

Solve::svars: Equations may not give solutions for all "solve" variables.

and gives spurious solutions such as {y -> (-I/2)*(-I + Sqrt[3])}, in addition to the correct ones.

How can I suppress / correct this strange behavior?

$\endgroup$
  • 1
    $\begingroup$ I formatted your answer. Please learn how to do it yourself here. I also removed the bug tag, until it is confirmed as a bug $\endgroup$ – yohbs Sep 14 '15 at 21:17
  • $\begingroup$ Also, I cannot reproduce the problem on my machine (MMA 10.2 on Ubuntu). Does the problem persist when you use a fresh kernel? (that is, if you restart the kernel, and only run the commands here)? $\endgroup$ – yohbs Sep 14 '15 at 21:20
  • $\begingroup$ Both work fine for me, giving the same answer, on 10.2 on Mac OS X. Reduce works as well. $\endgroup$ – Mark Adler Sep 14 '15 at 21:21
  • 4
    $\begingroup$ bugs is reserved until it is confirmed by the community or WRI. I can reproduce this on 8.0.1 and 9.0.1, but not on 10.0.2. So, I think its fixed. $\endgroup$ – rcollyer Sep 14 '15 at 21:22
  • $\begingroup$ As a workaround you can eliminate elements of the solution that don' t include both variables: Solve[eq, {x, y}] // Select[#, Length[#] == 2 &] & $\endgroup$ – Bob Hanlon Sep 14 '15 at 21:53
2
$\begingroup$

This is not an answer but an extended comment.

On MMA V8.0.1, note the following:

eq = {1 + x^3 - 5*x*y + y^3 == 0,
  3 - 5*x*y + ((1 + I*Sqrt[3])*(-5*x + 3*y^2))/2 == 0};

sol = eq /. First@Solve[eq, {x, y}] // Expand
(* {2 + (5 x)/2 + 5/2 I Sqrt[3] x + x^3 == 0, True} *)

Then,

xsols = Solve[First@sol, x]
(* {   {x -> I (I + Sqrt[3])}
     , {x -> 1/2 (1 - I Sqrt[3] - I Sqrt[4 + 4 I Sqrt[3]])}
     , {x -> 1/2 (1 - I Sqrt[3] + I Sqrt[4 + 4 I Sqrt[3]])}   }  *)

and

xsols2 = First /@ Solve[eq, {x, y}][[2 ;; 4]];
Flatten@xsols === xsols2
(* True *)

In other words, it's not really finding spurious solutions. It's more like it's trying to do too much work.

$\endgroup$
0
$\begingroup$

Thanks for all the comments.

A robust workaround seems to be to use Solve[Reduce[system], ...] in place of Solve[system, ...].

I am still surprised that such a basic bug is still present in Mathematica 9.0.

$\endgroup$
  • $\begingroup$ @blochwave "Thanks" appears to be incidental to the "robust workaround" given herein. $\endgroup$ – Mr.Wizard Sep 25 '15 at 14:12
  • $\begingroup$ @Mr.Wizard you're right, mea culpa! $\endgroup$ – dr.blochwave Sep 25 '15 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.