Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: Q: How to force an Equal[]

  • Subject: [mg3359] Re: [mg3332] Q: How to force an Equal[]
  • From: brucec (Bruce Carpenter)
  • Date: 29 Feb 1996 11:25:06 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: daemon at wri.com

>Hi there,
>
>this should be a nice relaxing one. How can I force Mma to evaluate
>the equal expression, regardless of what values Word or Number
>stand for. I just want a false in the second case (y1==y2).
>
>
>In[]:=
>x1={car, nose, 2334.34};
>x2={dummy, 3.1415, 8};
>x3={eye,345,567};
>
>In[]:=
>y1=Map[Head,x1]//.{Symbol->Word,Integer->Number, Real->Number}
>y2=Map[Head,x2]//.{Symbol->Word,Integer->Number, Real->Number}
>y3=Map[Head,x3]//.{Symbol->Word,Integer->Number, Real->Number}
>
>Out[]:=
>{Word, Word, Number}
>{Word, Number, Number}
>{Word, Number, Number}
>
>Here we go:
>
>y2==y3
>
>gives me as desired
>True
>
>But this guy just returns the expressions:
>y1==y2
>
>{Word, Word, Number} == {Word, Number, Number}
>
>I would like to see a False here.It works when I do
>{Symbol->"Word", ...}, converting it to Strings. But I wouldn't
>call that a nice style of writing inMma.
>
>Thanks
>Gerd
>
>
>
>
>Gerd Lanfermann
>840 N.Taylor
>St.Louis, Mo. 63122
>USA
>phone: (314) / 822 4518
>email: s997826 at umslvma.umsl.edu          (University of Missouri, St.Louis)
>       lanfer at sirius.physik.fu-berlin.de (Freie Universitaet Berlin)

I believe you want to use y1 === y2, which is the infix form of SameQ[y1, y2].

Cheers,
Bruce Carpenter




  • Prev by Date: Re: Q: How to force an Equal[]
  • Next by Date: Re: Re: Ticks
  • Previous by thread: Re: Q: How to force an Equal[]
  • Next by thread: Re: Q: How to force an Equal[]