-1
$\begingroup$

The command

ContourPlot[{RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 
10/3 + y + 1/y}, {x, -5, 5}, {y, -5, 5}, PlotPoints -> 50]

enter image description here

, as one sees, draws abstraction in blue. With the options

ContourPlot[{RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 
10/3 + y + 1/y}, {x, -5, 5}, {y, -5, 5}, PlotPoints -> 300, WorkingPrecision -> 50]

one obtains an empty plot. The command

Region[ImplicitRegion[RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 10/3 + 1/y + y, {x, y}],
PlotRange -> {{-5, 5}, {-5, 5}}]

Region[Embedding dimension: 2]

fails too. Just to compare, see the result of the the command of Maple 2021

plots:-implicitplot (abs (x + 1/y) + abs (x + 1/y) = 10/3 + y + 1/y, x = -5 .. 5, y = -5 .. 5);

enter image description here

I think this is not only a graphics problem. Let us consider

Reduce[{RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 10/3 + y + 1/y}, x, Reals] 

(y == -3 && x == 1/3) || (-3 < y < -(1/3) && -(1/y) <= x <= 1/3 (10 + 3 y)) || (y == -(1/3) && x == 3) || (y > 0 && -(1/y) <= x <= 1/3 (10 + 3 y))

and the result in Maple of

solve (abs (x + 1/y) + abs (x + 1/y) = 10/3 + y + 1/y, x);

piecewise (y < -3, [], y = -3, [1/3], y < -1/3, [(3*y^2 + 10*y - 3)/(6*y), (-3*y^2 - 10*y - 9)/(6*y)], y = -1/3, [3], y <= 0, [], 0 < y, [(3*y^2 + 10*y - 3)/(6*y), (-3*y^2 - 10*y - 9)/(6*y)])

The latter is in accordance with the plot done in Maple, whereas the former does not seem true.

Is there a way to plot the implicit function under consideration in Mathematica?

PS. Sorry for the poor question. My incorrect Maple code misled me (This is explanation, but not justification.).

$\endgroup$
4
  • 1
    $\begingroup$ Simplify[RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 10/3 + y + 1/y , 1/4 <= x <= 22/3 && y == 4] is True. It means that the picture contain the segment Line[{1/4,4},{22/3,4}] $\endgroup$
    – cvgmt
    Oct 12, 2021 at 13:13
  • $\begingroup$ Please don't use the bugs tag unless it's confirmed. $\endgroup$
    – gwr
    Oct 12, 2021 at 13:21
  • $\begingroup$ @gwr: I submitted it few years ago. $\endgroup$
    – user64494
    Oct 12, 2021 at 14:26
  • $\begingroup$ BTW, Region[ImplicitRegion[ RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 10/3 + 1/y + y && x >= -5 && x <= 5 && y >= -5 && y <= 5, {x, y}], PlotRange -> {{-5, 5}, {-5, 5}}] should to work, but the command doesn't. $\endgroup$
    – user64494
    Oct 13, 2021 at 4:54

2 Answers 2

7
$\begingroup$

You are trying to visualize the relation $$ |f(x,y)| + |g(x,y)| = f(x,y) + g(x,y) $$ where $f(x,y) = x+1/y$ and $g(x,y) = \frac{10}{3} - x + y$. In the above form, it is fairly evident that this relation is satisfied if and only if $f(x,y) \geq 0$ and $g(x,y) \geq 0$. In other words, this equation does not define a contour; it defines a region:

RegionPlot[{Abs[x + 1/y] + Abs[10/3 - x + y] == 10/3 + y + 1/y}, {x, -5, 5}, {y, -5, 5}, PlotPoints -> 50]

enter image description here

Increasing the value of PlotPoints leads to better definition of the "corners" at $(-3,\frac13)$ and $(-\frac13,3)$, and also reduces the length of the spurious "stem" along the positive $x$-axis.

Knowing this, it appears that the Mathematica output you provide from Reduce (which involves allowed ranges of x for each y value) is correct. The fact that Maple outputs a 1-D curve when using plots is highly misleading; and the output of solve is correct only if (for example)

[(3*y^2 + 10*y - 3)/(6*y), (-3*y^2 - 10*y - 9)/(6*y)]

stands for the interval between these two endpoints. (I am not familiar enough with Maple syntax to know whether the above output stands only for two distinct points, or whether it implicitly includes the interval between them as well.)

$\endgroup$
4
  • $\begingroup$ Are you serious? Could you ground your '"You are trying to visualize the relation..." ? TIA. Hope you understand this is not it. Thank you anyway. $\endgroup$
    – user64494
    Oct 12, 2021 at 14:33
  • 3
    $\begingroup$ @user64494: My point is that the equation you are plotting, which can be written as $$\left|x + \frac{1}{y}\right| + \left| \frac{10}{3} - x + y \right| = \left( x + \frac{1}{y} \right) + \left( \frac{10}{3} - x + y \right)$$does not define a set of curves; it defines a 2-D region of the plane. As such, RegionPlot is more appropriate. ContourPlot is finding that points in the interior of this region also satisfy the equation, which is why it tries to fill in the region with lines. ... $\endgroup$ Oct 12, 2021 at 14:40
  • $\begingroup$ That said, I'm a bit taken aback by your comment; if this doesn't answer your question then I've definitely misunderstood it. Can you elaborate on what you're looking for? $\endgroup$ Oct 12, 2021 at 14:41
  • $\begingroup$ Thank you. I got it. My Maple code was incorrect. $\endgroup$
    – user64494
    Oct 12, 2021 at 14:49
1
$\begingroup$

From the docs: (under Possible Issues)

Contours f(x,y)==0 for functions where f(x,y)>=0 are always poorly detected

f[x_?NumberQ, y_?NumberQ] := 
 Boole[RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 10/3 + y + 1/y]

Giving a value in between allows for easy contouring:

ContourPlot[f[x, y] == 0.5, {x, -5, 5}, {y, -5, 5}, PlotPoints -> 50]

enter image description here

$\endgroup$
4
  • $\begingroup$ Sorry, this is a plot of Boole[RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 10/3 + y + 1/y]==0.5, not the required plot. I also don't understand how Boole can take 0.5. Could you explain it? TIA. $\endgroup$
    – user64494
    Oct 12, 2021 at 14:31
  • $\begingroup$ Sorry, I still don't see any explanation of work Boole[RealAbs[x + 1/y] + RealAbs[10/3 - x + y] == 10/3 + y + 1/y]==0.5. $\endgroup$
    – user64494
    Oct 12, 2021 at 15:31
  • $\begingroup$ This is a wrong answer. I don't understand upvotes for it. $\endgroup$
    – user64494
    Oct 12, 2021 at 16:03
  • 1
    $\begingroup$ @user64494 Obviously you didn't get this answer: How can you state it "wrong"? $\endgroup$ Oct 12, 2021 at 20:11

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