D[myFunc[g[x]]] -> myFunc[D[g[x],x]: How to do in chain rule ???
- To: mathgroup at yoda.physics.unc.edu
- Subject: D[myFunc[g[x]]] -> myFunc[D[g[x],x]: How to do in chain rule ???
- From: Simon Chandler <simonc at hpcpbla.bri.hp.com>
- Date: Mon, 24 Aug 92 20:10:24 +0100
(* Hi mathgroup, I hope you can help with this problem. 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, just write... *) myFunc/: D[myFunc[g_],x_]:=myFunc[D[g,x]] (* so that *) D[myFunc[g[x]],x] (* gives *) myFunc[g'[x]] (* That's great. But now lets try differentiating another arbitrary function, f, acting on myFunc. I want the chain rule to convert d f[myFunc[g[x]]] d myFunc[g[x]] ----------------- into f'[myFunc[g[x]]] * -------------- (2) dx dx which would then be converted by (1) into d g[x] f'[myFunc[g[x]]] * myFunc[ ------ ] (3) dx What actually happens is ... *) D[f[myFunc[g[x]]],x] f'[myFunc[g[x]]] g'[x] myFunc'[g[x]] (* If you use Trace on this you will see that the intermediate step in the chain rule (2) does not seem to be produced so there is no opportunity for our defined property for myFunc to act *) Trace[D[f[myFunc[g[x]]],x]] {D[f[myFunc[g[x]]], x], f'[myFunc[g[x]]] myFunc'[g[x]] g'[x], {myFunc'[g[x]] g'[x], g'[x] myFunc'[g[x]]}, f'[myFunc[g[x]]] g'[x] myFunc'[g[x]], f'[myFunc[g[x]]] g'[x] myFunc'[g[x]]} (* Can anyone suggest how I might define a rule/property for myFunc so that it is transparent to differentiation even in the chain rule and so give me the result I want ? I look forward to your answers, Simon Chandler Hewlett-Packard Ltd (CPB) Filton Road Stoke Gifford Bristol BS12 6QZ Tel: 0272 228109 Fax: 0272 236091 email: simonc at hpcpbla.bri.hp.com *) *)