Re: Peculiar output from Union ?
- To: mathgroup at smc.vnet.net
- Subject: [mg108519] Re: Peculiar output from Union ?
- From: Chris Osborn <chrisosb at gmail.com>
- Date: Sun, 21 Mar 2010 02:07:10 -0500 (EST)
- References: <ho1ui0$hov$1@smc.vnet.net>
On Mar 20, 2:47 am, Jack L Goldberg 1 <jackg... at umich.edu> wrote:
> Hi Folks,
>
> Can anyone explain this:
>
> In[1]:= Union[ 1 < x < 2, 3 < x < 5 ]
>
> Out[1]= 5 < x
>
> ??
>
> I am using a MacBook Pro, OS 10.6.2
>
> Thanks,
>
> Jack
Hi Jack,
Union is usually applied to lists (expressions with head "List") like:
Union[ {3, 2, 1}, {4, 3} ] --> {1,2,3,4}
(it sorts the elements and removes duplicates).
If you apply it to inequalities it will treat the inequalities like
expressions with head "Less", e.g.:
Union[ Less[1, x, 2], Less[3, x, 5] ] --> Less[1, 2, 3, 5, x]
Here it has sorted the elements 1, x, 2, 3, 5, and x, and removed
duplicates.
The simplifier notices this is equivalent to:
Less[5, x]
or
5 < x
Chris