# Combine ImplicitRegion

I have a starting and a target set which I would like to represent via ImplicitRegion. I can evolve each point p of the starting set into an interval depending on p, for instance [p-1, p+1].

Now I would like to find the subset of the starting set from which I can actually land anywhere on the target set. I tried to represent this as the ImplicitRegion overlapping the target set.

My attempt does not give the expected answer :

start = ImplicitRegion[0 <= x <= 10, {x}];
minR[y_] = y - 1;
maxR[y_] = y + 1;
target = ImplicitRegion[2 <= x <= 4 || x == 7, {x}];

ImplicitRegion[
p \[Element] start &&
RegionMeasure[
RegionIntersection[ImplicitRegion[minR[p] <= yy <= maxR[p], yy],target]] > 0,
{p}]


The desired output would be ImplicitRegion[1 <= x <= 5 || x == 6 || x == 8, {x}]

Bear in mind the element value is treated locally within ImplicitRegion so inserting an expression for the element is not straightforward, and an expression like ImplicitRegion[something]-1 doesn't yield a new ImplicitRegion directly. However, you can take advantage of a number of related built-in functions for testing and manipulation of a given ImplicitRegion. For your test case you can do something like:

startR = ImplicitRegion[{0 <= x <= 5 || 7 <= x <= 10}, {x}];
Print["Measurement: ", RegionMeasure[startR]]];
NumberLinePlot[Reduce@Element[{x}, startR]], {x, -1, 11}]


Measurement: 8

targetR = ImplicitRegion[2 <= x <= 4 || x == 7, {x}];
Print["Measurement: ", RegionMeasure[targetR]]];
NumberLinePlot[{Reduce@Element[{x}, targetR]}, {x, -1, 11}]


Measurement: 2

uppR[delta_] = ImplicitRegion[2 + delta <= x <= 4 + delta || x == 7 + delta, {x}];
lowR[delta_] = ImplicitRegion[2 - delta <= x <= 4 - delta || x == 7 - delta, {x}];

Module[{r = RegionUnion[uppR[1], lowR[1]]},Print["Measurement: ", RegionMeasure[r]];
NumberLinePlot[{Reduce@Element[{x}, r]}, {x, -1, 11}]]


Measurement: 4

Module[{r = RegionIntersection[startR, RegionUnion[uppR[1], lowR[1]]]},
Print["Measurement: ", RegionMeasure[r]];
NumberLinePlot[{Reduce@Element[{x}, r]}, {x, -1, 11}]]


Measurement: 4

Note that I made the start region slightly more complex to make the final result less trivial and illustrate the action of the intersection in the final step.

• Thanks for the suggestions, but can you modify uppR and lowR so they take the target region as an input ? I want to repeat the step start->target several times and it would be ideal if I can use NestList or similar. – b.gates.you.know.what Oct 1 '14 at 18:44
• If your element value is always constrained to a 1D interval, why not use the built-in Interval representation instead of ImplicitRegion? You can directly add intervals, e.g., Interval[{1, 6}] + Interval[{0, 2}] yields the result Interval[{1, 8}]. – dionys Oct 1 '14 at 20:30