       Re: comparing rewite rules

• To: mathgroup at smc.vnet.net
• Subject: [mg78368] Re: comparing rewite rules
• From: dimitris <dimmechan at yahoo.com>
• Date: Fri, 29 Jun 2007 05:47:12 -0400 (EDT)
• References: <f5vsg8\$l2f\$1@smc.vnet.net>

```dbsearc... at yahoo.com       :
> Hello Mathematica UG:
>
> I input these 2 simple rewrite rule sets into Mathematica V5:
>
> - {yy -> 4, y -> 3}
>
> - {y -> 3, yy -> 4}
>
> I just want to compare these 2 simple rules for equality. I tried:
>
> - define each one and use % == %% (this just gives: {yy -> 4, y -> 3}
>  == {y -> 3, yy -> 4} )
> - making a symbol for each rule set and using ==, such as rul0 ==
> rul1,
>  it just echoes my input
>
> I also tried to replace the rules in an expression. If the replaced
> result evaluates to a simple expression, it is OK but, it still fails
> sometime when Mathematica reorders expressions, such as when x-1 becomes -1 +
> x
>
> Is it possible to determine in my code that 2 "rule lists" are the
> same?
>
> Of course, in the general case, I will have many more rules than just
> these 2 small lists (e.g. Solve[] output).
>
>
> Regards..Roger

In:=
o1 = -{yy -> 4, y -> 3}
o2 = -{y -> 3, yy -> 4}
Sort /@ {o1, o2}
Equal @@ %

Out=
{-(yy -> 4), -(y -> 3)}

Out=
{-(y -> 3), -(yy -> 4)}

Out=
{{-(y -> 3), -(yy -> 4)}, {-(y -> 3), -(yy -> 4)}}

Out=
True

```

• Prev by Date: Re: Exclusions in V6
• Next by Date: Re: comparing rewite rules
• Previous by thread: Re: comparing rewite rules
• Next by thread: Re: comparing rewite rules