MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: "Transparency" with respect to differentiation


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


  • Prev by Date: Re: Simplifying {0,0,0}.X.{0,0,0}
  • Next by Date: Re: Replacing list elements while retaining structure
  • Previous by thread: Re: Problem with Which
  • Next by thread: Re: "Transparency" with respect to differentiation