D[myFunc[g[x]
- To: mathgroup at yoda.physics.unc.edu (Mathematica User's Group)
- Subject: D[myFunc[g[x]
- From: Keith Clay <clay at galileo.phys.washington.edu>
- Date: Tue, 25 Aug 92 11:01:32 MDT
In Re: the following...
> I want to give the function 'myFunc'
> the property of being 'transparent' to differentiation.
> i.e., I want to have
>
> d myFunc[g[x]] d g[x]
> -------------- give me myFunc[ ------ ] (1)
> dx dx
>
> where g is an arbitrary function. "Easy" I hear you say...
Actually, I didn't say that. But here is one simple solution.
--------------------------------------------------------------------
In[1]:= Unprotect[D]
Out[1]= {D}
In[2]:= D[MyFunc[a_],b_]:=MyFunc[D[a,b]]
In[3]:= Protect[D]
Out[3]= {D}
(* That's it!
Other functions are unchanged... *)
In[4]:= D[Sin[x^n],x]
-1 + n n
Out[4]= n x Cos[x ]
(* MyFunc now behaves as advertised. *)
In[5]:= D[MyFunc[x^n],x]
-1 + n
Out[5]= MyFunc[n x ]
In[6]:= D[MyFunc[x^n],n]
n
Out[6]= MyFunc[x Log[x]]
In[7]:= Quit
There may be many other solutions.
Keith (clay at galileo.phys.washington.edu)