Re: "Transparency" with respect to differentiation

*To*: mathgroup at smc.vnet.net*Subject*: [mg74029] Re: "Transparency" with respect to differentiation*From*: Martin Schoenecker <ms_usenet at gmx.de>*Date*: Wed, 7 Mar 2007 03:06:00 -0500 (EST)*Organization*: Technische Universitaet Darmstadt*References*: <es909c$2c5$1@smc.vnet.net>

Regarding the object quat with the following properties > quat[a_+b_]:=quat[a]+quat[b] > quat/:D[quat[fun_],var__]:=quat[D[fun,var]] The unwanted behaviour was that differenciation was carried out before distribution: > In[8]:= D[quat[f[x] + g[x]], x] > Out[8]= f'[x] quat'[f[x]] + g'[x] quat'[g[x]] I found out with the help of the Mathematica Reference Guide, A.2.7 that UpValues have a higher precedence than DownValues, which explains this behaviour. Trying to give the needed rule explicitly results in quat /: D[quat[(a_) + (b_)], var__] := D[quat[a], var] + D[quat[b], var] $Failed TagSetDelayed::"tagpos":" .... too deep for an assigned rule to be found. Now the question, reformulated, is: how could I define the mentioned properties so that they would be carried out in the right order? Thanks, Martin