MathGroup Archive 2005

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

Search the Archive

Re: Dropping Similar Numbers from List


x={1.,1.-10^-15,1.-10^-6};

Union[x]

{0.999999,1.,1.}

Looking in the Help browser or

Options[Union]

{SameTest -> Automatic}

Union[x,SameTest->(Abs[#1-#2]<10^-10&)]

{0.999999,1.}


Bob Hanlon

> 
> From: "andre" <erasmus.the.giant at gmail.com>
To: mathgroup at smc.vnet.net
> Date: 2005/09/20 Tue AM 05:19:43 EDT
> Subject: [mg60580] [mg60564] Dropping Similar Numbers from List
> 
> My data set has some numbers which differ by a small amount, say one
> part in 10^-15, that I don't want to appear more than once.  If they
> were identical, I would just use Union[data] and be finished.  Is there
> a way to set a tollerance for the Union function?
> 
> I tried to use SetPrecision to get rid of the unwanted extra digits,
> but Union[SetPrecision[data,n]] gives the same result as Union[data].
> What exactly does SetPrecision do?  It seems that it's not just
> dropping the digits beyond the limit I set.
> 
> Andre
> 
> 


  • Prev by Date: Mathemaica 5.2 are the 64 Bit an illusion !!!....?
  • Next by Date: Re: "layering" 2d plots
  • Previous by thread: Re: Dropping Similar Numbers from List
  • Next by thread: Re: Dropping Similar Numbers from List