Re: substitution of functions in derivatives
- To: mathgroup at smc.vnet.net
- Subject: [mg3415] Re: [mg3384] substitution of functions in derivatives
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Wed, 6 Mar 1996 01:45:26 -0500
- Sender: owner-wri-mathgroup at wolfram.com
pyl at ccr.jussieu.fr (lagre) in [mg3384] substitution of functions in derivatives raises the following problem (slightly simplified) f=u[x,y]; df=D[f,x]; df/.u[x_,y_]->Cos[x y] (1,0) u [x, y] Not the expected -(y*Sin[x*y]) One solution is df/.u->(Cos[#1 #2]&) -(y Sin[x y]) Explanation: FullForm[df] Times[a, Derivative[1, 0][u][x, y]] does not contain u[x_,y_]. * We must replace u with a two place function (x,y) --> Cos[x,y] * Here are four other way of doing this df/.u->Function[{x,y}, Cos[x y]] v[x_,y_] := Cos[x y] df/.u->v df/.(v[x_,y_] := Cos[x y];u->v) df/.(u -> (v[x_,y_] := Cos[x y];v)) Allan Hayes hay at haystack.demon.co.uk ==== [MESSAGE SEPARATOR] ====