Re: TransformationFunctions
- To: mathgroup at smc.vnet.net
- Subject: [mg102288] Re: TransformationFunctions
- From: O <kakabomba at gmail.com>
- Date: Tue, 4 Aug 2009 04:27:57 -0400 (EDT)
- References: <h46p31$e4g$1@smc.vnet.net> <200907230754.DAA26659@smc.vnet.net>
it works. i think it is good idea to report here what was wrong. I
used function with delayed assignment, and should use function with
delayed assignment and delayed rule. For now i can't fully understand
what is difference, but maybe this information will helpful for
somebody else.
In[1]:= WrongTransformation[l___ ** (a_ + b_) ** r___] := l ** a ** r
+ l ** b ** r
In[2]:= Simplify[a ** (b + c) ** d - a ** b ** d,
TransformationFunctions -> {Automatic, WrongTransformation}]
Out[2]:= -a ** b ** d + a ** (b + c) ** d
In[3]:= ProperTransformation[expr_] := expr /. l___ ** (a_ + b_) **
r___ :> l ** a ** r + l ** b ** r
In[4]:= Simplify[a ** (b + c) ** d - a ** b ** d,
TransformationFunctions -> {Automatic, ProperTransformation}]
Out[4]:= a ** c ** d
thanks