Re: TransformationFunctions
- To: mathgroup at smc.vnet.net
- Subject: [mg101922] Re: TransformationFunctions
- From: Peter Breitfeld <phbrf at t-online.de>
- Date: Thu, 23 Jul 2009 03:54:48 -0400 (EDT)
- References: <h46p31$e4g$1@smc.vnet.net>
". at ntaxa.com" wrote:
> Can anyone advice why following code does not work:
>
> In[538]:=tf[z_NonCommutativeMultiply] := -z[[2]]**z[[1]]
> In[539]:=Simplify[x ** y + y ** x,TransformationFunctions -> {tf,
> Automatic}]
> Out[539]:=x ** y + y ** x
>
> I expect rather 0
>
> By the way:
> In[540]:=x ** y + tf[y ** x]
> Out[540]:=0
>
I think, the problem here is, that Simplify will apply tf to both
products. So I would suggest you do something like this:
tfrule = (x_ ** y_ + y_ ** x_) :> 0;
tf[expr_] := expr /. tfrule;
Simplify[x ** y + y ** x, TransformationFunctions -> {tf}]
Out=0
--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de
- Follow-Ups:
- Re: TransformationFunctions
- From: O <kakabomba@gmail.com>
- Re: TransformationFunctions
- From: O <kakabomba@gmail.com>
- Re: Re: TransformationFunctions
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: TransformationFunctions