       Re: Making a new definition of Equal work with lists as well

• To: mathgroup at smc.vnet.net
• Subject: [mg63368] Re: Making a new definition of Equal work with lists as well
• From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
• Date: Tue, 27 Dec 2005 04:42:38 -0500 (EST)
• Organization: The Open University, Milton Keynes, U.K.
• References: <doohbr\$kua\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```"Dan Bernstein" <dan.bernstein at gmail.com> a écrit dans le message de news:
doohbr\$kua\$1 at smc.vnet.net...
| Hi,
|
| I have defined
| Equal[a_CL,b_CL] := a[]-a[] == b[]-b[]
| and then
| CL[2,3] == CL[4,5]
| CL[2,3] == CL[2,4]
| evaluate to True and False respectively, as expected. However,
| {CL[2,3]} == {CL[4,5]}
| just stays in that form.
|
| What should I do to make list equality use my "CL equality"?
|
| -- Dan Bernstein
|

Hi Dan,

A quick way is to use alternative patterns as in

In:=
Unprotect[Equal];
((a_CL) | {a_CL}) == ((b_CL) | {b_CL}) :=
a[] - a[] == b[] - b[]
Protect[Equal];

In:=
CL[2, 3] == CL[4, 5]
CL[2, 3] == CL[2, 4]

Out= True
Out= False

In:=
{CL[2, 3]} == {CL[4, 5]}
{CL[2, 3]} == {CL[2, 4]}

Out= True
Out= False

In:=
CL[2, 3] == {CL[4, 5]}
{CL[2, 3]} == CL[2, 4]

Out= True
Out= False

Best regards,
/J.M.

```

• Prev by Date: Re: Re: Questions regarding MatrixExp, and its usage
• Next by Date: Re: Making a new definition of Equal work with lists as well
• Previous by thread: Making a new definition of Equal work with lists as well
• Next by thread: Re: Making a new definition of Equal work with lists as well