Re: Peculiar output from Union ?
- To: mathgroup at smc.vnet.net
- Subject: [mg108517] Re: Peculiar output from Union ?
- From: Simon <simonjtyler at gmail.com>
- Date: Sun, 21 Mar 2010 02:06:48 -0500 (EST)
- References: ho1ui0$hov$1@smc.vnet.net
Hi Jack, that's pretty cool, but it comes from using Union where you shouldn't. The full form for, say, 1<x<2 is Less[1,x,2]. Let's replace Less with some unknown function f; In[1]:= Union[f[1,x,2],f[3,x,5]] Out[1]= f[1,2,3,5,x] In[2]:= %/.f->Less Out[2]= 5<x So Union does two things - it joins to objects with the same head together AND sorts their arguments into canonical order. For Less, this doesn't really make sense. Maybe you wanted to do something like: In[3]:= Reduce[1<x<2&&3<x<5] Out[3]= False In[4]:= Simplify[1<x<2&&3<x<5] Out[4]= False Simon On Mar 20, 3:47 pm, 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