MathGroup Archive 2007

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

Search the Archive

Re: Question about Union

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79241] Re: [mg79191] Question about Union
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 21 Jul 2007 04:40:44 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

Perhaps it rationalizes all numbers?

data = {0.6342350954011774, 0.6342350954011775};

Union[data]

{0.634235,0.634235}

Union[data, SameTest -> Equal]

{0.634235}

Union[data, SameTest -> SameQ]

{0.634235}

Union[data, SameTest -> (Rationalize[#1, 0] == Rationalize[#2, 0] &)]

{0.634235,0.634235}


Bob Hanlon

---- Yaroslav Bulatov <yaroslavvb at gmail.com> wrote: 
> Union treats 2 numbers as distinct even though SameQ returns true for
> them...how does it test whether values are distinct by default?
> 
> Union[{0.6342350954011774, 0.6342350954011775}]
> 0.6342350954011774===0.6342350954011775
> 
> 



  • Prev by Date: How to set a "slope style" of axe label in ParametricPlot3D?
  • Next by Date: Re: Mathematica to .NET compiler
  • Previous by thread: Re: Question about Union
  • Next by thread: Re: Question about Union