MathGroup Archive 2007

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

Search the Archive

Re: comparing rewite rules


Hi,


Sort /@ ({yy -> 4, y -> 3} == {y -> 3, yy -> 4})

because you have to bring the rules into a unique order.
General {a,b} is different from {b,a}, but in for a list
of rules the order does not have a meaning.

Regards
   Jens


dbsearch04 at yahoo.com wrote:
> 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).
> 
> Thanks in advance.
> 
> Regards..Roger
> 
> 


  • Prev by Date: Re: Plotting two functions
  • Next by Date: Re: Suggestions for Maintaining "Object" State?
  • Previous by thread: Re: comparing rewite rules
  • Next by thread: Re: comparing rewite rules