ImplicitRegion evaluates the region incorrectly when it must be empty

Consider the following implicit region:

E1crit[m1_,m2_]=(m1^2+m2^2)/(2*m2);
Cosalpha[x_, y_, cosz_] = cosz*Sin[x]*Sin[y] + Cos[x]*Cos[y];
Cosalphamin[E1_, m1_, m2_] =
If[E1 > E1crit[m1, m2],
1/(2*m2)*Sqrt[4 E1^2 m2^2 - m2^4 - 2 m2^2 m1^2 - m1^4]/
Sqrt[E1^2 - m1^2], -1]
ymax=0.14003;
RegionX[m1_,E1_,m2_,x_]:=ImplicitRegion[Cosalpha[x, y, Cos[z]]-Cosalphamin[E1, m1, m2]>=0,{{y,0,ymax},{z,0,Pi}}]


This region is shrinked very fast for $$E_{1}>E_{1 \text{crit}}$$, and for each $$E_{1},m_{1},m_{2}$$ there is critical $$x_{\text{crit}}$$ for which the region is empty. But for $$x>x_{\text{crit}}$$ Mathematica fails to show the empty region:

RegionPlot[RegionX[6, 5*E1crit[6, 6.3], 6.3, 0.149]]


shows the correct region, while

RegionPlot[RegionX[6, 5*E1crit[6, 6.3], 6.3, 0.15]]


displays the errors:

RegionPlot::nnregion: ImplicitRegion[-0.99995+0.988771 cos(y)+0.149438 cos(z) sin(y)>=0\[And]0<=y<=0.14003\[And]0<=z<=\[Pi],{y,z}] cannot be automatically discretized.

RegionPlot::argr: RegionPlot called with 1 argument; 3 arguments are expected.


How to force it to set the region above the critical value to zero automatically?

• If[x > xcrit, EmptyRegion[2], ImplicitRegion[...]]? Or use Reduce on the region predicate? Commented Oct 9, 2018 at 12:57
• @MichaelE2 : xcrit is different for different E1,m1,m2. That is why I want Mathematica to do it itself. Commented Oct 9, 2018 at 13:00
• So Reduce might work, then? Or since you're doing things numerically, perhaps DiscretizeRegion[reg, Method -> "Continuation"] is ok? Or you can take the error as evidence that the region is probably empty. Commented Oct 9, 2018 at 13:13
• @MichaelE2 : sorry for this stupid question, but how I have to apply Reduce? Commented Oct 9, 2018 at 14:30
• @MichaelE2 : I will need to use this region for integration. Commented Oct 9, 2018 at 14:42

Here's a way to apply Reduce to the predicate (= first argument) for the ImplicitRegion:

MapAt[Reduce, RegionX[6, 5*E1crit[6, 6.3], 6.3, 0.15], 1]


ImplicitRegion::msgs: Evaluation of {Reduce[-0.99995+0.988771 Cos[y]+0.149438 Cos[z] Sin[y]>=0&&0<=y<=0.14003&&0<=z<=π],True} generated message(s) {Reduce::ratnz}.

(*  Out[]= EmptyRegion[2]  *)


RegionPlot will give an empty plot on this input.

One could manually Rationalize the ImplicitRegion before passing it to Reduce to eliminate the warning message.

Reduce solves symbolically and can be slow. One can speed it up a little by rationalizing with a larger tolerance. For example reducing Rationalize[<region>, 1*^-8] takes under 12s instead of under 20s.

Is that what is desired?

From the geometry of the inequality in the case at hand -- that is:

• u = {Cos[x], Sin[x]} is a unit vector (a parameter)
• v = {Cos[y], Sin[y]} is a unit vector (an unknown)
• w = {vx, t*vy}, where {vx, vy} = v and t = Cos[z] (another unknown)
• w lies in the segment of the unit disk where y <= ymax
• The inequality is that the length of the projection of w on u should be greater than a certain radius

One can see that the vertex of the segment of the unit disk where t = Coz[z] is equal to 1 and y is equal to ymax is the only vector w satisfying the inequality when x equals $$x_{\text{crit}}$$.

Then the following gives $$x_{\text{crit}}$$ (the larger solution):

NSolve[(First@RegionX[6, 5*E1crit[6, 6.3], 6.3, x] /. GreaterEqual -> Equal) &&
0 < x < π /. {z -> 0, y -> ymax},
x, Reals]
(*  {{x -> 0.130079}, {x -> 0.149981}}  *)

• Thank you very much! Commented Oct 9, 2018 at 15:32