Name: Peter (email_not_shown)
Date: 05/17/15-08:47:54 PM Z


I am new to this package, and I might be not using the definitions correctly, so please excuse me.
If I assign same values to AntiCommutator and Commutator more than
once, they all appear in the DownValues for these functions, as

(*Definitions as in the package*)
Do[AntiCommutator[a,b]=1,{i,1,5}];
Do[Commutator[x,y]=1,{i,1,5}];
DownValues[AntiCommutator]
DownValues[Commutator];

{HoldPattern[{ a , b }]:>1,HoldPattern[{ a , b }]:>1,HoldPattern[{ a , b }]:>1,HoldPattern[{ a , b }]:>1,HoldPattern[{ a , b }]:>1}

I checked the definitions for these functions, see for example the
package definition for AntiCommutator below:

Block[ {nd, acom},
nd = (RuleDelayed @@ {HoldPattern @@ {acom[a, b]},c}) /. acom -> AntiCommutator;

If[FreeQ[DownValues[AntiCommutator], nd],
PrependTo[DownValues[AntiCommutator], nd] ];

It does have a verification for avoiding the redundant assignments.
However, the FreeQ is known not to work too well with HoldPattern.
 One easy way out is to use Verbatim around nd in FreeQ, see below

If[FreeQ[DownValues[AntiCommutator], Verbatim[nd]],
PrependTo[DownValues[AntiCommutator], nd]];

The same change works for Commutator definition. Nor sure, how these changes could impact other functionality.

Great package you have, thank you !

Peter



This archive was generated by hypermail 2b29 : 09/04/20-12:55:05 AM Z CEST