       Re: check identity of lists

• To: mathgroup at yoda.physics.unc.edu
• Subject: Re: check identity of lists
• From: bert at netcom.com (Roberto Sierra)
• Date: Sat, 28 Aug 93 02:30:22 -0700

```"Tone Dieckmann"  <TONE at econ.uni-mannheim.de> wrote:
> Hi guys!
> I want to check whether the outputs of two functions, which are both
> lists, are identical. Now look at this:

> In := {True, True} == {True, True}
> Out = True                      (this is what I want)

> But:
> In := Blabla[x]
> Out = {True, True}

> In := Whatever[y]
> Out = {True, True}

> In := %2 == %3
> Out = {True, True} == {True, True}    (why not just say "True"?)

> In := %2 === %3
> Out = False                     ???

> In := Evaluate[%2] == Evaluate[%3]
> Out = {True, True} == {True, True}   (hopeless!)

> Has anyone got any idea why this happens?
> Thanks for any help.

I can't give you a definitive answer as to why the above is happening,
but I suspect that there's something wrong with your functions and that
one of the lists is not *actually* {True,True}, but contains something
screwy when closely examined.

I tried to reproduce your results under MMA 2.03 for the Macintosh, and
couldn't make the problem happen.  I don't have the most up-to-date version
(it's possible that what you're seeing only occurs in newer versions).

In := {True,True} == {True,True}
Out = True

In := BlahBlah[item_] := {True,True};

In := Whatever[item_] := {True,True};

In := BlahBlah[x]
Out = {True, True}

In := Whatever[y]
Out = {True, True}

In := %4 == %5
Out = True   (*CORRECT!!*)

In := %4 === %5
Out = True   (*CORRECT!!*)

OK.  I tried again, this time with the two functions actually *doing*
something -- same results.

In := Whatever[item_] := {Length[item]==0,Sin[2 Pi] == 0};

In := BlahBlah[x]
Out = {True, True}

In := Whatever[y]
Out = {True, True}

In := %10 == %11
Out = True   (*Correct again!!*)

In := %10 === %11
Out = True   (*Correct again!!*)

The only way I could generate results which looked like what you were
seeing was to substitute "True" for True in one of the lists, which
prints out the same way as True, but is, of course, not equal to it.

In := BlahBlah[item_] := {True, True};

In := Whatever[item_] := {True, "True"};

In := BlahBlah[x]
Out = {True, True}

In := Whatever[y]
Out = {True, True}

In := %16 == %17
Out = {True, True} == {True, True}  (*Correct, but looks strange*)

In := %16 === %17
Out = False    (*Correct, but sure looks funny*)

I would suggest that you examine the workings of your functions closely,
you may be able to figure out what is happening.  If it still stumps you,
post your functions to the group.

\\|//                        | "Due to the earthquake in the area you
- -                         |  are calling, your call cannot be
o o                         |  completed." -- N.E. Telephone, 10/89
J   roberto sierra         |
O   tempered microdesigns  |  NOTICE:
\_/  san francisco, calif.  |  All the ideas and opinions expressed
bert at netcom.com        |  herein are not those of the author.

```

• Prev by Date: When do we get common subexpression elemination in Mma ?
• Next by Date: Re: Mma Notebook to "PDEs with Mathematica (Dimitri Vvedensky)"
• Previous by thread: Re: check identity of lists
• Next by thread: Literature Survey Notebook