# Finding all solutions of the system of equations

**URL:** <https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268>\
**Category:** Questions\
**Tags:** algebra, equation-solving, graphics-and-visualization, numerical-computation\
**Created:** [December 26, 2022, 5:09pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268 "2022-12-26T17:09:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinvalos](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sinvalos](https://community.wolfram.com/u/sinvalos)\
**Post date:** [December 26, 2022, 5:09pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268/1 "2022-12-26T17:09:44Z")

</div>

Hello guys.

I want to determine the set of solutions (zeros), for the interval of -8 \< x \< 8 and -8 \< y \< 8, of the following system of equations:

```
eq1 = x^4 - 1999/1000 x^2 y^2 + y^4 == 1;
eq2 = Tan[x + y] - y Sin[x] == 0;

pp1 = ContourPlot[{eq1, eq2} // Evaluate, {x, -8, 8}, {y, -8, 8}, Axes -> True, AxesLabel -> Automatic]

```

I tried using the FindInstance function, but after a long wait with no response, I aborted the operation.

```
FindInstance[eq1 && eq2 && -8 < x < 8 && -8 < y < 8, {x, y}]
$Aborted

```

Then I collected points near all intersection locations with the Get Coordinates and Copy Graphics Selection options. Then I applied the FindRoot function.

```
cor = {{3.066, -3.276}, {3.192, -3.038}, {2.209, 1.909}, {3.161, 2.987}, {4.144, 3.986}, {4.017, 4.128}, {3.097, 3.24}, {1.988, 2.257}, {-3.165, 3.304}, {-3.118, 2.907}, {-1.168, 0.6402}, {-1.405, -0.977}, {-3.768, -3.625}, {-5.401, -5.369}, {-3.625, -3.657}, {-3.245, -3.371}, {-2.563, -2.753}, {-0.9774, -1.373}, {0.5923, -1.151}};

ta1 = {x, y} /. Table[FindRoot[{eq1, eq2}, {{x, cor[[i, 1]]}, {y, cor[[i, 2]]}}, AccuracyGoal -> 10, MaxIterations -> 1000], {i, Length[cor]}] // Quiet

{{3.09513, -3.2447}, {3.19226, -3.03953}, {2.1945, 1.95578}, {3.17233,3.01838}, {4.12451, 4.01996}, {4.02646, 4.13072}, {3.11331, 3.26186}, {2.01099, 2.24363}, {-3.18533, 3.32993}, {-3.08667, 2.92732}, {-1.19219, 0.649321}, {-1.39791, -0.977282}, {-3.76936, -3.64795}, {-5.39826, -5.36078}, {-3.58339, -3.70785}, {-3.25573, -3.39657}, {-2.55589, -2.74003}, {-0.936877, -1.37001}, {0.58816, -1.16004}}

points = Graphics[{Green, PointSize[0.015], Point[ta1]}];
Show[pp1, points, PlotRange -> All]

```

Is there a more practical way to accomplish this task?

Regards,  
Sinval

---

<div class="post-metadata">

**Author:** ![henrikschachner](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/henrikschachner/32/32119_2.png) [@henrikschachner](https://community.wolfram.com/u/henrikschachner)\
**Post date:** [December 26, 2022, 9:27pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268/2 "2022-12-26T21:27:16Z")

</div>

Sinval,

using `NSolve` and friends seems to be more “practical”:

```
eq1 = x^4 - 1999/1000 x^2 y^2 + y^4 == 1;
eq2 = Tan[x + y] - y Sin[x] == 0;
solPts = NSolveValues[eq1 && eq2, {x, y}, Reals];
ContourPlot @@ {{eq1, eq2}, {x, -8, 8}, {y, -8, 8}, Axes -> True, Epilog -> {Red, PointSize[Large], Point[solPts]}, ImageSize -> Large}

```

 ![contourplot0.png](https://global.discourse-cdn.com/wolfram/original/3X/7/f/7f46957fd50ccd1786dacd6a51ed0fd8f3a83c93.png)

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [December 26, 2022, 9:41pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268/3 "2022-12-26T21:41:00Z")

</div>

The second equation is singular in you region. You can eliminate the singularity by multiplying `eq2` by `Cos[x+y]` and then use `Solve`:

```
eq1 = x^4 - 1999/1000 x^2 y^2 + y^4 == 1;
eq2 = Sin[x + y] - y Sin[x] Cos[x + y] == 0;
sol0 = Solve[eq1 && eq2 && -8 < x < 8 && -8 < y < 8, {x, y}]

```

All 20 solutions are genuine, as we can check this way:

```
Sort[Abs[Cos[x + y] /. sol0] // N]

```

---

<div class="post-metadata">

**Author:** ![sinvalos](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sinvalos](https://community.wolfram.com/u/sinvalos)\
**Post date:** [December 27, 2022, 1:10pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268/4 "2022-12-27T13:10:43Z")

</div>

Indeed, using these functions, the evaluation is faster. Thank you for your attention Henrik and Gianluca.

---

<div class="post-metadata">

**Author:** ![sinvalos](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sinvalos](https://community.wolfram.com/u/sinvalos)\
**Post date:** [December 27, 2022, 4:06pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268/5 "2022-12-27T16:06:34Z")

</div>

Henrik and Gianluca, when I zoomed in on the bottom left edge of the graph, I noticed that the two points do not coincide with the intersections of the curves. This is normal?

```
eq1 = x^4 - 1999/1000 x^2 y^2 + y^4 == 1;
eq2 = Tan[x + y] - y Sin[x] == 0;
solPts = NSolveValues[eq1 && eq2, {x, y}, Reals];
ContourPlot @@ {{eq1, eq2}, {x, -8, 8}, {y, -8, 8}, Axes -> True, Epilog -> {Red, PointSize[Large], Point[solPts]}, PlotRange -> {{-5.7, -5.3}, {-5.7, -5.3}}}

```

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [December 27, 2022, 4:45pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268/6 "2022-12-27T16:45:29Z")

</div>

Just increase the precision, for example `PlotPoints->100`, or zoom in this way:

```
ContourPlot[Evaluate@{eq1, eq2}, {x, -5.7, -5.3}, {y, -5.7, -5.3}, 
 Axes -> True, Epilog -> {Red, PointSize[Large], Point[solPts]}]

```

---

<div class="post-metadata">

**Author:** ![sinvalos](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sinvalos](https://community.wolfram.com/u/sinvalos)\
**Post date:** [December 27, 2022, 4:59pm UTC](https://community.wolfram.com/t/finding-all-solutions-of-the-system-of-equations/21268/7 "2022-12-27T16:59:56Z")

</div>

Yes, now it’s perfect. Thanks again for the tip, Gianluca.
