5
$\begingroup$

Bug introduced in 10.4 and fixed in 11.0


I type

 l = 3
 r = ImplicitRegion[(x^2 + y^2)^3 == l *x^2* y^2, {x, y}];
 RegionPlot[r]

and I obtain

enter image description here

How could I obtain a good graph for viewing the implicit region, similar to what I obtain if I type <= instead of ==

enter image description here

$\endgroup$
  • 2
    $\begingroup$ I get one petal, not an empty plot in V11.0.1. $\endgroup$ – Goofy Feb 24 '17 at 23:58
  • 2
    $\begingroup$ 10.4.1 for Linux x86 (64-bit): no 2D examples from the docs give a plot. Not even RegionPlot[ImplicitRegion[x^2 + y^2 == 1, {x, y}]]. $\endgroup$ – corey979 Feb 25 '17 at 0:02
  • $\begingroup$ @Szabolcs In v11.0.1 RegionPlot plots only one petal. It seems the bug is fixed only partially... $\endgroup$ – Alexey Popkov Feb 25 '17 at 13:37
  • $\begingroup$ @AlexeyPopkov So does 10.3. That would be a different bug. One workaround is to specify the bounds manually. $\endgroup$ – Szabolcs Feb 25 '17 at 13:58
  • 1
    $\begingroup$ @Szabolcs Have you tried it? It doesn't work for me with v.11.0.1. $\endgroup$ – Alexey Popkov Feb 25 '17 at 14:50
4
$\begingroup$

RegionPlot is supposed to work with inequalities, rather than with equations. You can sort of trick it to show the boundary of the region corresponding to your equation:

RegionPlot[r, PlotStyle -> None]

Mathematica graphics

but a more general solution is to use ContourPlot:

ContourPlot[
 (x^2 + y^2)^3 == l*x^2*y^2,
 {x, y} ∈ Rectangle[{-0.8, -0.8}, {0.8, 0.8}],
 PlotPoints -> 100, MaxRecursion -> 3
]

Mathematica graphics

$\endgroup$
  • $\begingroup$ The common problem of CountourPlot is that is not exactly and there are "noise" in the near of center $\endgroup$ – Mika Ike Feb 25 '17 at 8:40
  • 1
    $\begingroup$ "RegionPlot is supposed to work with inequalities" <- I think it really should plot all 2D regions, and that this is a bug. RegionPlot[Circle[]] works. There are examples with equalities in the documentation of ImplicitRegion. $\endgroup$ – Szabolcs Feb 25 '17 at 9:31
  • 1
    $\begingroup$ @Szabolcs The documentation of RegionPlot is rather consistent on this point though. The first statement in the "Details" section says that RegionPlot takes "any logical combination of inequalities". The PlotStyle -> None "trick" to get a boundary is shown in the relevant "Options" section. The "Properties and Relations" sections also indicates explicitly that ContourPlot should be used for equalities. I'd love for RegionPlot to work with equalities as well, especially since it seems better at it than ContourPlot, but if it behaves in accordance with its docs, is it really a bug? $\endgroup$ – MarcoB Feb 25 '17 at 13:43
  • 2
    $\begingroup$ The documentation is never consistent, just don't take it literally. This is clearly a bug because it worked in previous versions (up to 10.3), it works in the following versions (11.0), and the usage appears in several documentation examples and Wolfram website examples. The fact that they forgot to fully update one doc page is irrelevant. $\endgroup$ – Szabolcs Feb 25 '17 at 13:57
  • 1
    $\begingroup$ The documentation seems to be pretty outdated on RegionPlot. It even says that the default style is grey-black. I submitted a suggestion for improvement (there's a link for that at the bottom of the online version of every doc page). $\endgroup$ – Szabolcs Feb 25 '17 at 15:46
4
$\begingroup$

This is a bug in 10.4. One-dimensional regions embedded in the plane will not be plotted by RegionPlot. For example,

RegionPlot[ImplicitRegion[x^2 + y^2 == 1, {x, y}]]

renders as an empty. In 10.3 and in 11.0.1, it can be plotted without problems.

However, the specific region you show has another problem, present even in 10.3 and 11.0. Only part of the region is shown:

A good workaround for 10.3 is to manually specify the boundaries. Well, we can do it semi-automatically using RegionBounds.

RegionPlot[r, PlotRange -> RegionBounds[r]]

Unfortunately, specifying the PlotRange in 11.0 causes a hang.


As you can see, there are at least 3 seemingly distinct bugs here, which affect different versions:

  • 10.4 won't plot 1D regions embedded in 2D. 10.0-10.3 and 11.0 do not suffer from this.

  • 10.0-11.0 will only plot a quarter of this specific region unless the PlotRange is manually specified. Also discussed in: Cannot reproduce TransformedRegion example shown in documentation

  • 10.4 and 11.0 hang if the PlotRange is manually specified for this region. This problem is not present in 10.0-10.3.

Note: I have not actually tested 10.1 and 10.2. I assumed that when 10.0 and 10.3 behave identically, so do any versions in-between.

$\endgroup$
2
$\begingroup$

In version 11: You can also use RegionBoundary,e.g:

reg = ImplicitRegion[(x^2 + y^2)^3 <= 3 x^2 y^2, {x, y}];
bndy = RegionBoundary[reg];
RegionPlot[bndy]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ with this example I obtain a blank graph (no graph) with windows , and version 10.4.1.0 $\endgroup$ – Mika Ike Feb 25 '17 at 8:39
  • $\begingroup$ @MikaIke apologies I gave version 11 $\endgroup$ – ubpdqn Feb 25 '17 at 8:45
0
$\begingroup$

Or:

r = ImplicitRegion[(x^2 + y^2)^3 < 3 x^2 y^2, {x, y}];
RegionPlot[r, PlotStyle -> White]

Incidentally, your l = 3 is irrelevant to the question (and should have a semicolon anyway) and should be removed.

$\endgroup$

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.