Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit4.readnews.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Michael Stern Newsgroups: comp.soft-sys.math.mathematica Subject: Does Union[] reliably sort? Date: Wed, 14 Dec 2011 11:10:06 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 30 NNTP-Posting-Date: 14 Dec 2011 10:14:50 GMT NNTP-Posting-Host: cb295ad7.news.twtelecom.net X-Trace: DXC=0@XYBTh>P0^G[n\L2_@9VQC_A=>8kQj6]=_1NR_H?JP];T8l36j_JW_EFiONJ7[GoVcg=SRLALkn[ X-Complaints-To: abuse@twtelecom.net Xref: x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:7206 I have noticed that if combine two lists of date/data objects using Union[], the result is sorted by date. For example In[]:= mins={{{2001, 1, 31}, 0.993268}, {{2002, 3, 31}, 1.01395}, {{2003, 6, 30}, 1.08647}, {{2005, 11, 30}, 1.14752}, {{2006, 9, 30}, 1.18938}, {{2007, 2, 28}, 1.19658}, {{2008, 1, 31}, 1.20432}, {{2011, 1, 31}, 1.37501}}; In[]:= maxs={{{2000, 10, 31}, 1.01816}, {{2001, 12, 31}, 1.02714}, {{2004, 2, 29}, 1.12702}, {{2005, 3, 31}, 1.16986}, {{2010, 10, 31}, 1.39026}}; In[]:= Union[maxs, mins] Out[]= {{{2000, 10, 31}, 1.01816}, {{2001, 1, 31}, 0.993268}, {{2001, 12, 31}, 1.02714}, {{2002, 3, 31}, 1.01395}, {{2003, 6, 30}, 1.08647}, {{2004, 2, 29}, 1.12702}, {{2005, 3, 31}, 1.16986}, {{2005, 11, 30}, 1.14752}, {{2006, 9, 30}, 1.18938}, {{2007, 2, 28}, 1.19658}, {{2008, 1, 31}, 1.20432}, {{2010, 10, 31}, 1.39026}, {{2011, 1, 31}, 1.37501}} Is this reliable behavior? Is there any case in which Union would /not/ return results that have been properly sorted by date? Thank you, -Michael Stern