MathGroup Archive 1999

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

Search the Archive

Re: equaltity of lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19077] Re: equaltity of lists
  • From: "Drago Ganic" <drago.ganic at in2.hr>
  • Date: Thu, 5 Aug 1999 01:35:00 -0400
  • References: <7o5ih1$rml@smc.vnet.net> <Pine.LNX.4.10.9908030840160.1020-100000@wabash.wolfram.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi there,

Thanks for the answers, but I still have questions.

1. I wanted to test the "objects" in a mathematical and not in
   a structural way. Therefore I believe I have to use == (Equal)
   not === (SameQ).

2. My reasoning was as follows
   (I'm not a mathematician so maybe it's wrong)

   In Mathematics the Set is a very basic way to collect some
   objects together and treat them as one. In Mathematica the
   same thing (only finite sets) is implemented with a list
   with ONE difference: a list has an order and a Set has not.
   (You can never implement something without order in the
    computer - you can only neglect the order).

   So mathematically spoken
   the set {a, b} IS EQUAL TO the set {b, a}.

   I can get this behavior in Mathematica if I write
 Union[{b, a}] == Union[{a, b}]
 True

   But when I tread the objects {a,b} and {b,a} as lists the
   answer to the question should be false if we look at the
   list as a supplement to the set in a mathematical way.

   Of course the same is with

 a == a
 True

   and

 a == b
 a == b

   or

 x == x^2
 x == x^2

   Why not False? I don't see that this is only a structural
   question ("use SameQ, don't use Equal and you will get False").
   The functions x and x^2 are mathematically not Equal, so an Equal
   should return False (the case x=1 is not important for function
   equality). Isn't a variable x just a function f (x) = x?

3. Just another example

   Simplify[(x^2-1)/(x-1)]
   1+x

   But the two functions are not mathematically identical
   (point x=1).

   When I try to plot the function

   Plot [(x^2-1)/(x-1),{x,-2,2}]

   I don't get the graph of the rational function (x^2-1)/(x-1).
   Instead I get the graph of the linear function 1+x.

   When I ask

   Reduce [ (x^2-1)/(x-1) == 1 + x, x]
   True

   What with x = 1  ?


Greetings
Drago Ganic

P.J. Hinton <paulh at wolfram.com> wrote in message
news:Pine.LNX.4.10.9908030840160.1020-100000 at wabash.wolfram.com...
> On 2 Aug 1999, Drago Ganic wrote:
>
> > Hi !!
> >
> > Why don't I get an answer (False) when I ask Mathematica
> >
> >     {a,b}=={b,a}
> >
> > like the one I get with
> >
> >     {1,2}=={2,1}
> >     False
>
> In order to get False as a result in your first example, you must use a
> stronger logical test function than Equal[].  You need to use SameQ[].
>
> In[1]:= {a,b} === {b,a}
>
> Out[1]= False
>
> --
> P.J. Hinton
> Mathematica Programming Group           paulh at wolfram.com
> Wolfram Research, Inc.
> Disclaimer: Opinions expressed herein are those of the author alone.
>




  • Prev by Date: Re: Conversion of output
  • Next by Date: Re: equaltity of lists
  • Previous by thread: Re: equaltity of lists
  • Next by thread: Re: equaltity of lists