5

Consider the following implicit region defined on one variable

reg = {x > 0 && x < 0}

If I Reduce this system, I obviously get

Reduce[reg]

False

However, If I use

RegionIntersection[ImplicitRegion[reg, {x}]]

I expect to get EmptyRegion[], instead I get the output

ImplicitRegion[x > 0 && x < 0, {x}]

Why does RegionIntersection not return EmptyRegion[]?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
apt45
  • 1,648
  • 9
  • 14
  • 1
    A simpler example (MWE): RegionIntersection[ImplicitRegion[C11 > 0 && C11 < 0, {C11}]] – Michael E2 Mar 04 '19 at 12:38
  • @MichaelE2 Thanks. So, why it is not returning EmptyRegion[]? Are my expectations wrong? – apt45 Mar 04 '19 at 12:40
  • Try DiscretizeRegion[ImplicitRegion[reg, {C11}]] -- I suppose regions are closed (i.e. boundaries are added). I don't know for sure though. – Michael E2 Mar 04 '19 at 12:41
  • RegionIntersection[ImplicitRegion[C11 > 0 && C11 < 0, {C11}]] //ArcLength evaluates to zero! – Ulrich Neumann Mar 04 '19 at 12:43
  • Reply to comment: If I knew why, I'd answer. You could simplify the question, though, by editing to the question to show a "minimal working code example". – Michael E2 Mar 04 '19 at 12:44
  • @MichaelE2 I am going to edit it – apt45 Mar 04 '19 at 12:45
  • @UlrichNeumann thanks for the tip, but it is only effective for one-dimensional regions (I have a code working with multi-variate regions). I need to understand why RegionIntersection is not returning EmptyRegion[]. – apt45 Mar 04 '19 at 12:49
  • RegionDimension yields -Infinity, which is consistent with EmptyRegion[1] and not with a single Point (which is what DiscretizeRegion returns). -- Update: RegionIntersection[reg, reg] fails but RegionIntersection[ImplicitRegion[C11 > 0 && C11 < 0, {C11}], ImplicitRegion[C11 < 0 && C11 > 0, {C11}]] returns EmptyRegion[1]...Hmm, I suspect RegionIntersection[r] does nothing in all cases, perhaps. – Michael E2 Mar 04 '19 at 12:51
  • Maybe this helps: RegionIntersection[reg, ImplicitRegion[-Infinity < x < Infinity, {x}]] – Michael E2 Mar 04 '19 at 13:07
  • Maybe this helps: MapAt[Simplify, ImplicitRegion[reg, {C11}], 1] -- in previous comment, I meant reg to be wrapped in ImplicitRegion[..] – Michael E2 Mar 04 '19 at 16:14

2 Answers2

4

Region-combination functions such as RegionIntersection call BooleanRegion to compute the result. For instance, RegionIntersection[reg1, reg2,…] is equivalent to BooleanRegion[And, {reg1, reg2,…}]

In turn, BooleanRegion seems to apply some basic logic to eliminate unnecessary computation. The following and their equivalent RegionIntersection calls return region without inspecting, simplifying, or otherwise altering region:

BooleanRegion[And, {region}]
BooleanRegion[And, {region, region}]  (* DeleteDuplicates[] is used to remove copies *)
BooleanRegion[And, {region, FullRegion[n]}]  (* where n is the dimension of region *)

Possible workarounds include intersecting region with a region distinct from region and FullRegion[n] that covers region. Simply specifying a full region as an ImplicitRegion or changing the variables in region suffice. Unfortunately Simplify[ImplicitRegion[..]] does nothing. In this case, if we apply Simplify or Reduce to the first argument gets around this.

ireg = ImplicitRegion[x < 0 && x > 0, {x}]
yreg = ireg /. x -> y  (* change variable *)
fullreg = ImplicitRegion[-Infinity < x < Infinity, {x}] (* a disguised full region *)
(*
  ImplicitRegion[x < 0 && x > 0, {x}]
  ImplicitRegion[y < 0 && y > 0, {y}]
  ImplicitRegion[-∞ < x < ∞, {x}]
*)

RegionIntersection[ireg, yreg]
RegionIntersection[ireg, fullreg]
(*
  EmptyRegion[1]
  EmptyRegion[1]
*)

Simplification:

MapAt[Simplify, ireg, 1]
MapAt[Reduce, ireg, 1]
(*
  EmptyRegion[1]
  EmptyRegion[1]
*)

It seems Mathematica is missing a RegionSimplify or RegionReduce function. At least, I didn't find one.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
-1

$\underline{\mathbf{UPDATE}}$

Q = ImplicitRegion[x > 0 && x < 0, {x}];
Q = If[RegionDimension[Q] == -\[Infinity], EmptyRegion[1]]

returns:

EmptyRegion[1]
mjw
  • 2,146
  • 5
  • 13
  • I don't see how this answers the question....and some of this answer was noted in the comments. – Michael E2 Mar 05 '19 at 02:16
  • The region of intersection is the empty region, which is one of the OP's points. The question is how to get it to simplify to it. It's okay to repeat from the comments, but usually the practice is to acknowledge the prior post(s). -- Not sure why the downvotes here. – Michael E2 Mar 05 '19 at 11:49