15
$\begingroup$

Bug introduced in 10.0 and persisting through 11.3 or later


In 11.3.0 for Microsoft Windows (64-bit) (March 7, 2018) writing:

f[w_, x_, y_, z_] := w*x^2*y^3 - z*(w^2 + x^2 + y^2 - 1)

eqn = {D[f[w, x, y, z], w] == 0, 
       D[f[w, x, y, z], x] == 0, 
       D[f[w, x, y, z], y] == 0, 
       D[f[w, x, y, z], z] == 0};

sol = Solve[eqn];

Table[eqn /. sol[[n]], {n, Length[sol]}]

I get:

{{True, True, True, True}, {True, True, True, True}, {True, True, True, True}, {True, True, True, True}, {True, True, True, True}, {True, True, True, True}, {True, True, True, True}, {True, True, True, True}, {False, True, True, False}, {True, True, True, True}, {True, True, True, True}, {False, True, True, False}, {True, True, True, True}, {True, True, True, True}, {False, True, True, False}, {True, True, True, True}, {True, True, True, True}, {False, True, True, False}, {True, True, True, True}, {True, True, True, True}}

from which there are four wrong solutions.

Am I wrong or is it a Solve[] bug?


EDIT: through the email address support@wolfram.com I contacted Wolfram Technical Support who in less than three working days have confirmed that it is a bug and have already proceeded to report to their developers.

$\endgroup$
4
  • 1
    $\begingroup$ You could use List@ToRules@Reduce[eqn, {x, y, z, w}] to get all valid solutions. Filter for those that only have numeric values on the RHS of ->. $\endgroup$
    – Szabolcs
    Jan 5, 2019 at 22:30
  • $\begingroup$ Select[sol, And @@ eqn /. # &] $\endgroup$
    – Bob Hanlon
    Jan 5, 2019 at 23:53
  • 5
    $\begingroup$ Next time, please do not add the bugs tag yourself on a question. The tag is only supposed to be added after your observations have been confirmed by other users. $\endgroup$ Jan 6, 2019 at 2:45
  • 1
    $\begingroup$ In version 12.0 bug is fixed. $\endgroup$ Apr 17, 2019 at 20:14

2 Answers 2

5
$\begingroup$

Thanks for asking! In version 9.0 only 16 solutions are returned and they are all valid. In version 10.2 there are 20 solutions, with the extra 4 all being invalid. Contragulations! I think you found a bug. You may want to click "Help", then "Give Feedback...", and then fill out the form in your browser to report.

As another answer notes, you can always try Reduce[] instead which may give better results in some cases, but Solve[] is usually what you want.

$\endgroup$
2
  • 2
    $\begingroup$ @TeM You should report it to Wolfram first, otherwise there's no chance for it to get fixed. $\endgroup$
    – Szabolcs
    Jan 5, 2019 at 22:31
  • 4
    $\begingroup$ @TeM wolfram.com/support/contact $\endgroup$
    – Szabolcs
    Jan 5, 2019 at 23:49
4
$\begingroup$

You can use Reduce

f[w_, x_, y_, z_] := w*x^2*y^3 - z*(w^2 + x^2 + y^2 - 1)
eqn = {D[f[w, x, y, z], w] == 0, D[f[w, x, y, z], x] == 0, 
   D[f[w, x, y, z], y] == 0, D[f[w, x, y, z], z] == 0};
red = Reduce[eqn, Backsubstitution -> True]

$\left(z=0\land x=0\land w=-\sqrt{1-y^2}\right)\lor \left(z=0\land x=0\land w=\sqrt{1-y^2}\right)\lor \left(z=0\land y=0\land w=-\sqrt{1-x^2}\right)\lor \left(z=0\land y=0\land w=\sqrt{1-x^2}\right)\lor (z=0\land y=-1\land x=0\land w=0)\lor (z=0\land y=0\land x=0\land w=-1)\lor (z=0\land y=0\land x=0\land w=1)\lor (z=0\land y=1\land x=0\land w=0)\lor \left(z=-\frac{1}{4 \sqrt{3}}\land y=-\frac{1}{\sqrt{2}}\land x=-\frac{1}{\sqrt{3}}\land w=\frac{1}{\sqrt{6}}\right)\lor \left(z=-\frac{1}{4 \sqrt{3}}\land y=-\frac{1}{\sqrt{2}}\land x=\frac{1}{\sqrt{3}}\land w=\frac{1}{\sqrt{6}}\right)\lor \left(z=-\frac{1}{4 \sqrt{3}}\land y=\frac{1}{\sqrt{2}}\land x=-\frac{1}{\sqrt{3}}\land w=-\frac{1}{\sqrt{6}}\right)\lor \left(z=-\frac{1}{4 \sqrt{3}}\land y=\frac{1}{\sqrt{2}}\land x=\frac{1}{\sqrt{3}}\land w=-\frac{1}{\sqrt{6}}\right)\lor \left(z=\frac{1}{4 \sqrt{3}}\land y=-\frac{1}{\sqrt{2}}\land x=-\frac{1}{\sqrt{3}}\land w=-\frac{1}{\sqrt{6}}\right)\lor \left(z=\frac{1}{4 \sqrt{3}}\land y=-\frac{1}{\sqrt{2}}\land x=\frac{1}{\sqrt{3}}\land w=-\frac{1}{\sqrt{6}}\right)\lor \left(z=\frac{1}{4 \sqrt{3}}\land y=\frac{1}{\sqrt{2}}\land x=-\frac{1}{\sqrt{3}}\land w=\frac{1}{\sqrt{6}}\right)\\ \lor \left(z=\frac{1}{4 \sqrt{3}}\land y=\frac{1}{\sqrt{2}}\land x=\frac{1}{\sqrt{3}}\land w=\frac{1}{\sqrt{6}}\right)$

First@eqn //. {ToRules[red]}

{True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True}

$\endgroup$
1
  • 4
    $\begingroup$ I believe Solve use the function Reduce under the hood. when you remove Backsubstitution -> True, you'll find implicit solution, somehow Solve messes up somewhere and it is definitely a bug.. $\endgroup$ Jan 6, 2019 at 1:18

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.