Prev: Docked cells and TagBoxNote / StatusArea
Next: OneStepTopReduction in System` Context in Mathematica 6+?
From: Sjoerd C. de Vries on 21 Mar 2010 03:09 Jack, Union not only works on lists but on any function, as long as the functions to be united are the same. In this case we have the function Less: Union[Less[1,x,2],Less[3,x,5]] from which Union makes Less[1,2,3,5,x] (Union removes duplicates and sorts) This is equivalent to 1<2<3<5<x which simplifies to 5<x Cheers -- Sjoerd On Mar 20, 9:47 am, Jack L Goldberg 1 <jackg...(a)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
From: Bob Hanlon on 21 Mar 2010 03:12 It did exactly what the documentation said that Union would do. It joined the elements of the two "lists" (the heads of the "lists" do not have to be List but they must be the same), then sorted the distinct joined elements. All of the numbers are ordered before x so you are just left with 5 < x. Union[1 < x < 2, 3 < x < 5] // Trace {HoldForm[Union[1 < x < 2, 3 < x < 5]], HoldForm[ 1 < 2 < 3 < 5 < x], HoldForm[5 < x]} Bob Hanlon ---- Jack L Goldberg 1 <jackgold(a)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
From: Raffy on 22 Mar 2010 03:54 On Mar 20, 12:47 am, Jack L Goldberg 1 <jackg...(a)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 FullForm/Trace of what you have written: Union[Less[1,x,2], Less[3,x,5]] === Union[Less[1,2,3,5,x]] === Less[1,2,3,5,x] === Less[5,x] Recall, Union is expecting its arguments to be "sets" (with a common head) and the actual Union is with respect to the elements of those "sets".
First
|
Prev
|
Pages: 1 2 3 Prev: Docked cells and TagBoxNote / StatusArea Next: OneStepTopReduction in System` Context in Mathematica 6+? |