MathGroup Archive 2006

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

Search the Archive

Re: IntervalComplement


Andrzej Kozlowski

Thanks for the reply. I wish I had your computer & math skills. :-]

I also wish my second email had gone out on the same day as the first
(where I provided a hacked example that worked for numeric intervals).

Anyway, thanks again.

On 10/12/06, Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
>
> On 12 Oct 2006, at 18:38, Chris Chiasson wrote:
>
> > Has anyone implemented this function before? I need something that
> > can do this.
> >
> > (IntervalComplement is to IntervalUnion as Complement is to Union)
> >
> > --
> > http://chris.chiasson.name/
> >
>
>
> I think this should do it:
>
> IntervalComplement[s_Interval, t_Interval] := Module[{FromInterval,
> y, p},
> FromInterval[x_Interval] := Or @@ (x /. {a_?NumericQ, b_?NumericQ} :>
>         LessEqual[a, y, b]); p = ((CylindricalDecomposition
> [FromInterval[s]
> && Not[FromInterval[t]], y]) /. HoldPattern[Inequality[a_?NumericQ,
> Less |
>                LessEqual, y, Less | LessEqual, b_?NumericQ]] :> {
>        a, b}); If[Head[p] === Or, Interval @@ p, Interval[p]]]
>
>
> For example:
>
>
> IntervalComplement[Interval[{2,6}],Interval[{3,4}]]
>
> Interval[{2,3},{4,6}]
>
> Andrzej Kozlowski
> Tokyo, Japan
>


-- 
http://chris.chiasson.name/


  • Prev by Date: RE: Beginner--[Plz Help] I don't want to display a POLARPLOT but use SHOW Command
  • Next by Date: Re: Beginner--[Plz Help] I don't want to display a POLARPLOT but use SHOW Command
  • Previous by thread: Re: IntervalComplement
  • Next by thread: Re: IntervalComplement