MathGroup Archive 2007

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

Search the Archive

Re: "Transparency" with respect to differentiation

  • To: mathgroup at
  • Subject: [mg74107] Re: "Transparency" with respect to differentiation
  • From: Martin Schoenecker <ms_usenet at>
  • Date: Sat, 10 Mar 2007 06:53:32 -0500 (EST)
  • Organization: Technische Universitaet Darmstadt
  • References: <> <esr1f4$6o7$>

> In[3]:=
> oldheads = "ExcludedFunctions" /. ("DifferentiationOptions" /. 
> Developer`SystemOptions["DifferentiationOptions"]);
> In[4]:=
> Developer`SetSystemOptions["DifferentiationOptions" ->
>      "ExcludedFunctions" -> Append[oldheads, quat]] // InputForm
> In[5]:=
> D[quat[x], x] // InputForm
> In[6]:=
> quat /: D[quat[a_], x_] := quat[D[a, x]]
> quat[a_Plus] := Distribute[Unevaluated[quat[a]]]

> In[7]:=
> D[quat[f[x] + g[x]], x] // OutputForm
> Out[7]//OutputForm=
> quat[f'[x]] + quat[g'[x]]


Thank you, Carl, for your suggestions!  Still, I'm not sure about 
changing default values in Mathematica.  Now I got the idea for this 
marker we called quat not to mark all of the expression, but only the 
Head.  So define a method that makes functions quattened:

quatify[a_Plus] := Distribute[Unevaluated[quatify[a]]]
SetAttributes[quatify, Listable]
quatify[arg_] := quat[Head[arg]] @@ arg

And, because it looks ugly, format the output a bit nicer, by prepending 
a "d" to the marked functions:

In[4]:= quat /: MakeBoxes[quat[fun_],
      form:StandardForm | TraditionalForm] :=

Test the above:

funlist = {f[x], f[x] + g[x], h[x, y]}
qfunlist = quatify[funlist]
Dqfunlist = D[qfunlist, x]

Out[5]= {f[x], f[x] + g[x], h[x, y]}
Out[6]= {df[x], df[x] + dg[x], dh[x, y]}
{df'[x], df'[x] + dg'[x], dh     [x, y]}

The above is human readable, but still interpretable for Mathematica:

   Plus[Derivative[1][quat[f]][x], Derivative[1][quat[g]][x]],
   Derivative[1, 0][quat[h]][x, y]]

D[c quatify[k[x, y, z]], x]

c dk       [x, y, z]

Best Regards,

  • Prev by Date: RE: Re: Multi-core Support in Mathematica 5.2
  • Next by Date: Re: Evaluate a spline function
  • Previous by thread: Re: "Transparency" with respect to differentiation
  • Next by thread: ReadList and columns