MathGroup Archive 2003

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

Search the Archive

Re: "Sloppy Union"? (Union of a list with *nearly* equal elements)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41907] Re: [mg41892] "Sloppy Union"? (Union of a list with *nearly* equal elements)
  • From: Bobby Treat <drmajorbob-MathGroup3528 at mailblocks.com>
  • Date: Mon, 9 Jun 2003 05:20:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

SetPrecision doesn't give less than machine precision.  When you try, 
you still get machine precision.

Bobby

-----Original Message-----
From: AES/newspost <siegman at stanford.edu>
To: mathgroup at smc.vnet.net
Subject: [mg41907] [mg41892] &quot;Sloppy Union&quot;?  (Union of a list with 
*nearly* equal elements)

I'm trying to make a &quot;Sloppy Union&quot; that will eliminate 
elements of a list that are *almost* but not precisely duplicates of 
each other; and Union[ ] has the &quot;SameTest-&gt;test&quot; option 
which looks like what I need. I don't understand, however, why the 
following approach seems to work Remove[&quot;Global`*&quot;] 
sloppyData = Table[Random[Integer, {1000,1005}] + Random[Real, 
{-0.01,0.01}], {20}] Union[sloppyData, SameTest -&gt; 
(Abs[#1-#2]&lt;10.^-1&amp;)] but the following doesn't 
Remove[&quot;Global`*&quot;] sloppyData = Table[Random[Integer, 
{1000,1005}] + Random[Real, {-0.01,0.01}], {20}] sharperData = 
SetPrecision[sloppyData, 4] Union[sharperData, SameTest -&gt; 
(Abs[#1-#2]&lt;10.^-1&amp;)] --even though shaperData seems to have 
reduced precision. P.S. to Wolfram: Although 
&quot;SameTest-&gt;test&quot; is listed as an option in the online 
Help, neither &quot;SameTest&quot; or &quot;test&quot; are explained in 
the online Help system, and the only example of SameTest given in The 
Mathematica Book has the syntax &quot;SameText -&gt; comp&quot; rather 
than &quot;SameTest-&gt;test&quot;. Are &quot;test&quot; and 
&quot;comp&quot; the same? -- &quot;Power tends to corrupt. Absolute 
power corrupts absolutely.&quot; Lord Acton (1834-1902) 
&quot;Dependence on advertising tends to corrupt. Total dependence on 
advertising corrupts totally.&quot; (today's equivalent) 


  • Prev by Date: Strange behavior of Cross[]
  • Next by Date: Re: Fw: Re: Multiplying permutations RCVD_IN_UNCONFIRMED_DSBL,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG
  • Previous by thread: Re: "Sloppy Union"? (Union of a list with *nearly* equal elements)
  • Next by thread: help on color function!