"Transparency" with respect to differentiation
- To: mathgroup at smc.vnet.net
- Subject: [mg73846] "Transparency" with respect to differentiation
- From: Martin Schoenecker <ms_usenet at gmx.de>
- Date: Fri, 2 Mar 2007 06:23:26 -0500 (EST)
- Organization: Technische Universitaet Darmstadt
I would like to use a dummy object, that has the only task to mark its argument function. So I could use a previously undefined symbol for that pupose: In[1]:= quat[f[x]+g[x]] Out[1]= quat[f[x]+g[x]] Now I would like this flag to distribute over Plus: each element in the argument sum has the property of being "quat": In[2]:= quat[a_+b_]:=quat[a]+quat[b] quat[f[x]+g[x]+h[x]] DownValues[quat] Out[3]= quat[f[x]]+quat[g[x]]+quat[h[x]] Out[4]= {HoldPattern[quat[a_+b_]]\[RuleDelayed]quat[a]+quat[b]} So this property is stored as DownValue of quat. Then, I would like the quat to be transparent with respect to differentiation, and I thought it would be a good idea to store this property as an UpValue for quat rather than changing the (Protected!) D: In[6]:= quat/:D[quat[fun_],var__]:=quat[D[fun,var]] D[quat[f[x]],x] Out[7]= quat[f'[x]] which seems to work alright. However, a combination requiring both properties does not work easily, the derivative of quat w.r.t. its argument is produced: In[8]:= D[quat[f[x] + g[x]], x] (D[#1, x] &)/@quat[f[x] + g[x]] Out[8]= f'[x] quat'[f[x]] + g'[x] quat'[g[x]] Out[9]= quat[f'[x]] + quat[g'[x]] So how could I define an object, distributing over Plus and transparent w.r.t. differentiation more conveniently? And, additionaly, how could I define a standard form of this object, that returns a 'nicer' version (however maybe a bit less unambiguous), like the integrate sign appearing when asking for Integrate? My attempts to understand TagBox and InterpretationBox (if these constructs would help) were fruitless until now. Regards, Martin
- Follow-Ups:
- Re: "Transparency" with respect to differentiation
- From: Carl Woll <carlw@wolfram.com>
- Re: "Transparency" with respect to differentiation