Re: Interval arithmetic and Dependency problems
- To: mathgroup at smc.vnet.net
- Subject: [mg96896] Re: Interval arithmetic and Dependency problems
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 26 Feb 2009 08:03:14 -0500 (EST)
On 2/25/09 at 4:04 AM, aanderson at amherst.edu (Andy Anderson) wrote: >Mathematica symbolizes a disjoint interval as Interval[], and this >might result from, say >IntervalIntersection[Interval[{0,1}], Interval[{2,4}]]. >While I would like to think of this as a "null" interval, one >without any range (in particular Interval[{0,0}]), But Interval[{0,0}] is not a "null" interval. Instead it is an interval containing a single point on the real line. If Interval[{0,0}] was defined to be a "null" interval, how would you deal with IntervalIntersection[ Interval[{-1,0}], Interval[{0,1}] ] >Mathematica >instead treats this object as the same thing as Interval[{Infinity, >-Infinity}], i.e. completely off the real line (not explained in the >documentation). Therefore, >Interval[{0,1}] + Interval[] == Interval[] (rather than >Interval[{0,1}]) Hmm... It looks like you are expecting Interval[{0,1}] + Interval[] to represent the union of two intervals. If so, why aren't you using the function IntervalUnion, i.e., In[12]:= IntervalUnion[Interval[{0, 1}], Interval[]] Out[12]= Interval[{0,1}] And if you aren't using Interval[{0,1}] + Interval[] to be the union of the two intervals, what are you defining the sum of two intervals to be? >More importantly, I want to test if two intervals overlap or not. If >they don't, >IntervalIntersection[Interval[{0,1}], Interval[{2,4}]] == Interval[] >returns True, which is fine, but if they *do* overlap, >IntervalIntersection[Interval[{0,3}], Interval[{2,4}]] == Interval[] >does *not* return False but rather leaves it undetermined. Instead of Equal use SameQ, i.e., In[14]:= IntervalIntersection[Interval[{0, 3}], Interval[{2, 4}]] === Interval[] Out[14]= False