4
$\begingroup$

I've run into a problem with IntervalUnion and IntervalIntersection when dealing with symbolic intervals.

The following code should give Interval[{a,b},{c,d}]

IntervalUnion[Interval[{a, b}], Interval[{c, d}]]

...however it spits itself back unevaluated. The same goes for:

IntervalIntersection[Interval[{a, b}], Interval[{c, d}]]

Which one would hope generates another Interval, yet again is unevaluated. But everything is fine as long as you use numbers, for instance:

IntervalIntersection[Interval[{1.2, 3.9}], Interval[{2.6, 5.1}]]

... gives the expected Interval[{2.6, 3.9}]. It seems counterintuitive that I can't use them with symbols. I came across this when trying to find the shared support of two probability distributions (which does nothing):

IntervalIntersection @@ (DistributionDomain /@ 
 {TriangularDistribution[{0, k}, 0], UniformDistribution[{0, 1}]})

(*Result: IntervalIntersection[Interval[{0, k}], Interval[{0, 1}]]  *)

I'd hope to see the result Interval[{0,Min[1,k]}] or is that asking too much of Mathematica to generate assumptions on the k? Mathematica is already good at generating piecewise functions for variables assumptions in many other contexts, but not here. Something like this would be incredibly useful, especially if you wanted to do symbolic intergration restricted to the intersection of lots of symbolic intervals without going through them all or generating a big list of x\[Element]s1 && x\[Element]s2 && x\[Element]s3 ... constraints.

$\endgroup$
  • $\begingroup$ I've been trawling through the documentation and there is no mention of intervals with symbols, only numbers and Infinity... so it's presumably unimplemented. $\endgroup$ – Histograms May 26 '15 at 0:18
  • 1
    $\begingroup$ This might have something to do with the fact that everything is taken to be complex-valued unless explicitly told otherwise. What if you wrap things in an Assuming[] with the necessary assertions? $\endgroup$ – J. M. will be back soon May 26 '15 at 1:06
  • 1
    $\begingroup$ OK, this produces a better result, but I don't why we have to use {x}: Reduce[{x} \[Element] RegionUnion[Interval[{a, b}], Interval[{c, d}]] && x \[Element] Reals, {x, a, b, c, d}, Reals]. $\endgroup$ – Michael E2 May 26 '15 at 1:21
  • 1
    $\begingroup$ @Guesswhoitis. still just prints itself. I tried doing an internal trace but it got me nowhere. I'm thinking that while this may not necessarially be a bug since the documentation doesn't mention symbolic interval endpoints, this is an overlooked feature that could potentially confuse a lot of users. $\endgroup$ – Histograms May 26 '15 at 1:33
  • 1
    $\begingroup$ Some evidence that M does not do much with symbolic intervals: FullSimplify[IntervalUnion[Interval[{a, b}], Interval[{a, b}]]] returns IntervalUnion[Interval[{a, b}], Interval[{a, b}]]. However, RegionUnion works as one would expect. $\endgroup$ – Michael E2 May 26 '15 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.