In general you can't know in advance how long you should wait for solutions (even you won't know if the system is capable to provide them at all). There is TimeConstrained[expr, constr]
to stop computation of expr
when it exceeds the time constraint constr
.
Nonetheless Solve
works fine (Reduce
even finer, this is a huge issue, see e.g. this post) and it is capable to provide solutions quickly if you supplement the system to be solved with appropriate restriction on variables. To realize what kind of restrictions you should add to solvers I'd recommend to examine thoroughly this post How to get intersection values from a parametric graph? Having used ContourPlot
you should easily figure out them. So we can get solutions
sols = y /.
Solve[ Sqrt[ Abs[x]^2 + Abs[-5 + y]^2] + Sqrt[Abs[-5 + x]^2 + Abs[y]^2] +
Sqrt[Abs[5 + x]^2 + Abs[y]^2] + Sqrt[Abs[x]^2 + Abs[5 + y]^2] == 24 &&
-6 < x < 6 && -6 < y < 6, y];
Solutions are represented in terms of the Root
objects, sometimes they can be rewritten in terms of radicals (see e.g. this post)
Now, we can plot the solutions:
Plot[ sols, {x, -2 Sqrt[6], 2 Sqrt[6]},
AspectRatio -> Automatic, PlotStyle -> Thick]
To realize what you might expect if you assume that y
is complex, it is advantageous to exploit ContourPlot
. I write y
as z == k I + y
, that is y
is the real part of z
, e.g. :
With[{k = 1.316},
ContourPlot[ Sqrt[Abs[x]^2 + Abs[-5 + k I + y]^2] + Sqrt[Abs[-5 + x]^2 + Abs[k I + y]^2]
+ Sqrt[Abs[5 + x]^2 + Abs[k I + y]^2] + Sqrt[Abs[x]^2
+ Abs[5 + k I + y]^2] == 24,
{x, -6, 6}, {y, -6, 6},
AspectRatio -> Automatic]]
To get a bit deeper insight we'll look at the animation.
soly =
Table[ ContourPlot[ Sqrt[Abs[x]^2 + Abs[-5 + k I + y]^2] + Sqrt[Abs[-5 + x]^2
+ Abs[k I + y]^2] + Sqrt[Abs[5 + x]^2 + Abs[k I + y]^2]
+ Sqrt[Abs[x]^2 + Abs[5 + k I + y]^2] == 24,
{x, -5, 5}, {y, -5, 5},
PlotLegends -> Placed[ Style[Row[{"k =", NumberForm[k, {4, 2}]}], Bold, 20],
{Left, Top}], ContourStyle -> Thick],
{k, -3.316, 3.316, 0.04}];
ListAnimate[ soly, Paneled -> False]