Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: IntervalComplement

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70324] Re: IntervalComplement
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Fri, 13 Oct 2006 01:30:07 -0400 (EDT)

On 10/12/06 at 5:38 AM, chris at chiasson.name (Chris Chiasson) wrote:

>Has anyone implemented this function before? I need something that
>can do this.

Hmm... One way to interpret what you have asked for is a 
function that returns a list of intervals containing all points 
not contained by the intervals returned by IntervalUnion. Using 
that as the function definition then IntervalComplement could be 
written as:

In[7]:=
IntervalComplement[int___Interval] :=
   ({Interval[{-Infinity, Min[#1]}],
      Interval[{Max[#1], Infinity}]} & )[
    Flatten[Apply[List, {int}, {1}]]]

testing:

In[9]:=
int1=Interval[{1,10}];
int2=Interval[{8,12}];
int3=Interval[{20,30}];
IntervalComplement[int1,int2,int3]

Out[12]=
{Interval[{-Infinity, 1}], Interval[{30, Infinity}]}

seems to work correctly. But this result doesn't seem useful to 
me which leads me to believe I don't really understand what you 
are asking for.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: sample programs
  • Next by Date: Re: IntervalComplement
  • Previous by thread: Re: IntervalComplement
  • Next by thread: Re: Re: IntervalComplement