MathGroup Archive 2007

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

Search the Archive

Re: "Transparency" with respect to differentiation

> Does something like the following meet your needs?
> In[1]:=
> quat[(a_) + (b_)] := quat[a] + quat[b];
> quat /: D[quat[fun_], var__] := quat[D[fun, var]];
> Unprotect[D];
> D[quat[(a_) + (b_)], var__] := D[quat[a], var] + D[quat[b], var];
> Protect[D];
> In[6]:=
> quat[f[x] + g[x] + h[x]]
> Out[6]=
> quat[f[x]] + quat[g[x]] + quat[h[x]]

Thank you! Yes, that works perfectly.  I'm just wondering if it was more 
proper style to achieve that without changing the definition of built-in 
commands, i.e. without having to Unprotect[D].  In the meanwhile, I will 
use your approach.

Best Regards,

  • Prev by Date: Re: Multi-core Support in Mathematica 5.2
  • Next by Date: Re: Rigid body equations
  • Previous by thread: Re: "Transparency" with respect to differentiation
  • Next by thread: analytic integration of InterpolatingFunction compositions