Name: Vladyslav Shtabovenko (email_not_shown)
Date: 05/17/15-11:43:54 PM Z


Dear Peter,

thanks for your interest in FeynCalc. This is indeed a nice observation
and a useful suggestion. Commutator and AntiCommutator are pretty much
standalone functions (except for some use in DotSimplify) so that one
can improve them without much worrying about breaking higher level routines.

I implemented your idea which is now in the repo:

<https://github.com/FeynCalc/feyncalc/commit/2ae75579be65565570b40a59424290e0058a2c24>

Cheers,
Vladyslav

Am 17.05.2015 um 20:47 schrieb Peter:
> 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