2
$\begingroup$

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}]

$\endgroup$

1 Answer 1

1
$\begingroup$

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

startR

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

Measurement: 2

targetR

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

unionR

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

Measurement: 4

resultR

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.

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$ Oct 1, 2014 at 18:44
  • $\begingroup$ 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}]. $\endgroup$
    – dionys
    Oct 1, 2014 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.