# What's going on with this system of equations?

The following system of equations has $6$ solutions $(ct=8,8,8,8,7,9)$ but Mathematica doesn't give any solution:

NSolve[{ Sqrt[EAx^2 + 0.0625 EAy^2] (EBx) + (EAx) Sqrt[
EBx^2 + 0.0625 EBy^2] == 0,
0.25 Sqrt[EAx^2 + 0.0625 EAy^2] EBy + 0.25 EAy Sqrt[EBx^2 + 0.0625 EBy^2] == 0,
EAy - EBy == 0,
-1 + 4 EAx^2 + EAy^2 == 0,
-1 + 4 EBx^2 + EBy^2 == 0,
-8 + ct + EAx - EBx == 0},
{ct, EAx, EAy, EBx, EBy}, Reals, WorkingPrecision -> 13]

 NSolve::infsolns: Infinite solution set has dimension at least 1.
Returning intersection of solutions with
(38650 ct)/65167-(41688 EAx)/65167-(153968 EAy)/195501+(185938
EBx)/195501+(153196 EBy)/195501 == 1. >>

{}


Why ?

• You have 6 equations for 5 variables there. Commented May 19, 2017 at 9:53
• Are you sure all the equations are correct? If you name the list of equations eqs, you can even Rationalize them, and check with exact Solve. But Solve[Rationalize[eqs] /. ct -> 8, {EAx, EAy, EBx, EBy}, Reals] returns {}, so there are actually no solutions for this. Since you claim that you know that solutions exist for ct == 8, can you give the values of the other variables that solve the equations? Commented May 19, 2017 at 9:54
• Solve[{Sqrt[EAx^2 + 1/16 EAy^2] (EBx) + (EAx) Sqrt[ EBx^2 + 1/16 EBy^2] == 0, 1/4 Sqrt[EAx^2 + 1/16 EAy^2] EBy + 1/4 EAy Sqrt[EBx^2 + 1/16 EBy^2] == 0, EAy - EBy == 0, -1 + 4 EAx^2 + EAy^2 == 0, -1 + 4 EBx^2 + EBy^2 == 0, -8 + ct + EAx - EBx == 0, ct \[Element] Reals}, {ct, EAx, EAy, EBx, EBy}] Commented May 19, 2017 at 10:03
• @KraZug There are 6 equations but the system is not overdetermined since the equations are not independent. Commented May 19, 2017 at 12:49
• @MariusLadegårdMeyer There are actually 6 solutions where ct is real, but another variables are not neccessarily real. See my answer. Commented May 19, 2017 at 14:09

Since one expects an appropriate number of solutions it is reasonable to play with Solve or Reduce rather than with NSolve, and such a conclusion is quite obvious for experienced users, but by no means there is a direct hint in documentation pages. There is a number of various issues related to distinction between symbolic and numeric capabilities of the system, I would recommend e.g. these posts to read carefully: Issue with NSolve as well as Backslide in NSolve in V11.1?. Basically one could belive there should be one to one correspondence between Solve and NSolve results, however implementation reality appears to be slightly different, the former function is much more sophisticated and has had more updates than the latter and this is why sometimes they provide inequivalent results besides issues qualified as simple bugs. Moreover, even a specific usage of Solve sometimes may seem quite unreasonable for an unexperienced users, nevertheless one can get much more with Solve than with NSolve.

To proceed further first we should evaluate Rationalize[{0.0625, 0.25 }] and substitute exact values to the original system. Now we have:

system = {Sqrt[EAx^2 + 1/16 EAy^2] EBx + EAx Sqrt[ EBx^2 + 1/16 EBy^2] == 0,
1/4 Sqrt[EAx^2 + 1/16 EAy^2] EBy + 1/4 EAy Sqrt[EBx^2 + 1/16 EBy^2] == 0,
EAy - EBy == 0,
-1 + 4 EAx^2 + EAy^2 == 0,
-1 + 4 EBx^2 + EBy^2 == 0,
-8 + ct + EAx - EBx == 0};


Although there are $6$ equations for $5$ variables the system is not contradictory since the equations are not independent and can be reduced to a system of $5$ equations.

The warning returned by NSolve appears to be false since it seems a reminiscence from what can be observed with

Reduce[system, {ct, EAx, EAy, EBx, EBy}];

Reduce::useq: The answer found by Reduce contains unsolved equation(s)
{0==-(1/2) Sqrt[1+12 EAx^2],0==-(1/2) Sqrt[1+12 EAx^2]}.
A likely reason for this is that the solution set depends on branch cuts of Wolfram
Language functions. >>


One can figure out that the problem with warning is not harmful. Evaluate Reduce[0 == -(1/2) Sqrt[1 + 12 EAx^2], EAx]. In fact, we get 6 solutions if we assume ct is real and allowing different variables to be complex:

Solve[ Join[ system, {ct ∈ Reals}], {ct, EAx, EAy, EBx, EBy}]


When playing with the domain specification Reals we can find only completely real solutions, there will be only two of them:

Solve[ system, {ct, EAx, EAy, EBx, EBy}, Reals]

  {{ct -> 7, EAx -> 1/2, EAy -> 0, EBx -> -(1/2), EBy -> 0},
{ct -> 9, EAx -> -(1/2), EAy -> 0, EBx -> 1/2, EBy -> 0}}


If we don't specify the domain there will be more solutions than 6,

ct /. Solve[system, {ct, EAx, EAy, EBx, EBy}] // Quiet

{ 7, 8, 8, 8, 8, 9,
8 - I/Sqrt[3], 8 - I/Sqrt[3], 8 + I/Sqrt[3], 8 + I/Sqrt[3]}


To summarize Reduce is to reduce equations and logic statements yielding sometimes more than one expects, for a more detailed discussion see What is the difference between Reduce and Solve?.

• "Basically one could belive there should be one to one correspondence between Solve and NSolve results" I would only believe this in the case where the solution set over the complexes is finite. Commented May 19, 2017 at 21:11
• @DanielLichtblau "One" is assumed to mean a newcomer, not an expert. Commented May 20, 2017 at 11:48

The infinite set of the solutions of the system under consideration can be found by Reduce[Rationalize[{Sqrt[EAx^2 + 0.0625 EAy^2] (EBx) + (EAx) Sqrt[ EBx^2 + 0.0625 EBy^2] == 0, 0.25 Sqrt[EAx^2 + 0.0625 EAy^2] EBy + 0.25 EAy Sqrt[EBx^2 + 0.0625 EBy^2] == 0, EAy - EBy == 0, -1 + 4 EAx^2 + EAy^2 == 0, -1 + 4 EBx^2 + EBy^2 == 0, -8 + ct + EAx - EBx == 0}], {ct, EAx, EAy, EBx, EBy}, Reals]

((ct==7&&EAx==1/2&&EAy==0)||(ct==9&&EAx==-(1/2)&&EAy==0))&&EBx==-8+ct+EAx&&EBy==EAy

• Would you explain what you mean by "infinite set of the solutions of the system". There is only a finite set of solutions, unless you refer to an (incorrect) warning of the system. Commented May 19, 2017 at 15:36
• @Artes One cannot solve for all variables; it is a parametrized solution set. Commented May 19, 2017 at 21:02
• @DanielLichtblau The system takes it as such but it's not, evaluate e.g. Reduce[Rationalize[system], {ct, EAx, EAy, EBx, EBy}, Reals,Backsubstitution -> True] or assume only ct to be real. Curiously, the system without specifying the domain does not resolve a simple equation 0==-(1/2) Sqrt[1+12 EAx^2] which seems to be a bug. Commented May 20, 2017 at 11:45
• @Artes (1) The ideal in question has mixed dimension and most solver methods will find the highest dimensional component (Reduce will find all of them). The "generic" solution set is the highest dimensional component. Commented May 20, 2017 at 15:43
• @Artes (2) If there is are parametrized roots then in general one or another might lead to a parasite solution for different values of the parameter. In this example it might be the case that one branch always is a parasite but this is not so easy to assess in general (and in particular it is problematic for the verifier used in Solve to remove parasite solutions). Commented May 20, 2017 at 15:45