Unexpected behavior of ImplicitRegion -> RegionPlot

I have two semicircles that are identical except that the second is shifted one unit to the right.

R1 := ImplicitRegion[0 <= y <= Sqrt[1 - x^2], {x, y}]
R2 := ImplicitRegion[0 <= y <= Sqrt[1 - (x - 1)^2], {x, y}]


When I plot them I get

What's up with the second plot? It should look the same as the first, right? Is this somehow a result of imaginary values of Sqrt?

• I've reproduced this and passed it along to the developers. Commented Oct 29, 2015 at 2:46
• @rcollyer Awesome, thanks! Some more (related) unexpected behavior is described in my comments on the answers. Commented Oct 29, 2015 at 3:35

Somehow Mathematica allows your variables to be Imaginary. Restrict them to Reals, and all works fine:

R1 := Assuming[{x, y} \[Element] Reals,
ImplicitRegion[0 <= y <= Sqrt[1 - x^2], {x, y}]];
R2 := Assuming[{x, y} \[Element] Reals,
ImplicitRegion[0 <= y <= Re@Sqrt[1 - (x - 1)^2], {x, y}]];


Hmmm.... it is curious that one must specify the full range of $x$ in RegionPlot[R2], but if you recast the equations this way:

R3 := Assuming[{x, y} \[Element] Reals,
ImplicitRegion[(x - 1)^2 +  y^2 <= 1 && y > 0, {x, y}]];


all works fine.

• This looks great. (I used RegionPlot[ImplicitRegion[{x, y} \[Element] Reals && 0 <= y <= Sqrt[1 - (x - 1)^2], {x, y}]], which gives the same result as your R2.) However, I only get a quarter-circle unless I also specify 0 ≤ x ≤ 2. Is there any way to have Mathematica figure out the window automatically? Commented Oct 29, 2015 at 0:09
• Hm. Very odd... I notice that I can drop the Real checking entirely with your amendment: RegionPlot[ImplicitRegion[(x - 1)^2 + y^2 <= 1 && y >= 0, {x, y}]]. I think your solution is the most foolproof. If there's documentation on the possible inaccuracies of RegionPlot I'd love to see it, but the current docs don't even mention the RegionPlot[region] syntax yet. Commented Oct 29, 2015 at 0:57
• @raxod502 - The form RegionPlot[region] is indirectly documented by the documentation for ImplicitRegion. Commented Oct 29, 2015 at 1:32

Since you shifted the oval you must shift the domain of x for the second region

R1 := ImplicitRegion[-1 <= x <= 1 && 0 <= y <= Sqrt[1 - x^2], {x, y}]

R2 := ImplicitRegion[0 <= x <= 2 && 0 <= y <= Sqrt[1 - (x - 1)^2], {x, y}]

GraphicsRow[RegionPlot /@ {R1, R2}]


• I don't understand why I have to specify the domain at all (for instance, I didn't have to in R1). For an ImplicitRegion, shouldn't Mathematica be able to figure it out automatically? Commented Oct 28, 2015 at 21:17
• @raxod502 - I agree that Mathematica should be able to figure it out; however, when you experience a problem then add information that you know: FunctionDomain[Sqrt[1 - x^2], x] is -1 <= x <= 1 and FunctionDomain[Sqrt[1 - (x - 1)^2], x] is 0 <= x <= 2. Commented Oct 28, 2015 at 23:12