0
$\begingroup$

I have the following function using ImplicitRegion:

Region222[a_] := 
 ImplicitRegion[
  Sqrt[x^2 + y^2 - a^2] >= 9, {{x, a, a + 2}, {y, a, a + 1}}]
Region222Reduced[a_] :=
 MapAt[Reduce, Region222[a], 1]
Function12[a_] := If[Region222Reduced[a] == EmptyRegion[2], 0, 222]

Function12 should compare ImplicitRegion with the empty region and return 0 if they coincide and 222 if they don't coincide. But it does not work properly for the case when the region does not coincide with EmptyRegion[2].

Could you please tell me what I do incorrectly?

$\endgroup$
1
$\begingroup$

Perhaps you can use one of the following predicates instead:

predicate1[region_] := RegionDimension[region]<0
predicate2[region_] := RegionMeasure[region] == 0

One of your empty regions:

region = Region222[3]
predicate1[region]
predicate2[region]

ImplicitRegion[ Sqrt[-9 + x^2 + y^2] >= 9 && 3 <= x <= 5 && 3 <= y <= 4, {x, y}]

True

True

And a non-empty region:

region = Region222[10]
predicate1[region]
predicate2[region]

ImplicitRegion[ Sqrt[-100 + x^2 + y^2] >= 9 && 10 <= x <= 12 && 10 <= y <= 11, {x, y}]

False

False

$\endgroup$
1
$\begingroup$

You can use RegionEqual for this.

RegionEqual[Region222[3], EmptyRegion[2]]
True
RegionEqual[Region222[10], EmptyRegion[2]]
False
RegionEqual[Region222[a], EmptyRegion[2]]
-9 < a <= -5 || 0 <= a < -3 + Sqrt[85]
$\endgroup$
  • $\begingroup$ RegionEqual doesn't work so well for inexact regions, as in the OP's previous queston. $\endgroup$ – Carl Woll Oct 9 '18 at 18:49
  • $\begingroup$ I think this is a common problem with a lot of the region functions. In[24]:= predicate3[region_] := RegionEqual[region, EmptyRegion[2]] In[25]:= Through[{predicate1, predicate2, predicate3}[ Region222[#[-3 + Sqrt[85]]]]] & /@ {Identity, N} Out[25]= {{False, False, False}, {True, True, True}} $\endgroup$ – Chip Hurst Oct 9 '18 at 21:35

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.