MathGroup Archive 2011

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

Search the Archive

Re: Using Equal with Real Numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123188] Re: Using Equal with Real Numbers
  • From: Alan <alan.isaac at gmail.com>
  • Date: Fri, 25 Nov 2011 04:59:13 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jalb8i$s6h$1@smc.vnet.net>

On Nov 24, 6:53 am, Gabriel Landi <gtla... at gmail.com> wrote:
> (This actually depends on the OS and perhaps other things). The point is
> that he recognizes 0.6 as a member of list1 but not 0.7, even though
> both have the same InputForms.


Can you please explain this in more detail?  I assume this turn on the
fact that "MemberQ tests for structural matches, not numerical
equality", but how can I see the structural mismatch? Why does it only
apply to 0.7? I.e.,

lst1 = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
lst2 = Range[0, 1, 0.1];
Map[MemberQ[lst2, #] &, lst1]

=> {True, True, True, True, True, True, True, False, True, True, True}

Thanks,
Alan Isaac



  • Prev by Date: Calculate an image mean withouth the "mean" command
  • Next by Date: Re: How to integrate a function over a polygon
  • Previous by thread: Re: Using Equal with Real Numbers
  • Next by thread: Re: Using Equal with Real Numbers