Re: Defining a derivative that distributes for a function
- To: mathgroup at smc.vnet.net
- Subject: [mg64253] Re: Defining a derivative that distributes for a function
- From: Andres Corrada-Emmanuel <acorrada at physics.umass.edu>
- Date: Wed, 8 Feb 2006 03:53:43 -0500 (EST)
- References: <ds9mqp$48$1@smc.vnet.net> <43E886C2.6020309@metrohm.ch>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Suppose f = MyIntegral and the the expression I'm differentiating is of the form MyIntegral[expr1] + MyIntegral[expr2]. The two expressions are not equivalent at all. Differentiating MyIntegral individually, I get D[MyIntegral[expr1],x] = MyIntegral[ D[expr1,x] ] But D[ MyIntegral[expr1] + MyIntegral[expr2],x] = D[expr1,x]*MyIntegral'[expr1] + D[expr2,x]*MyIntegral'[expr2]. This is not formally correct since D[expr1,x] contains variables that need to remain under MyIntegrate. Furthermore,if I don't define the derivative upvalue for f I get the expression 2xf'[x^2] + 4x^3f'[x^4]. So why is Mathematica not distributing the derivate upvalue that I defined? And how do I get it to distribute the derivative correctly? Quoting dh <dh at metrohm.ch>: > Hi Andreas, > both expressions are equivalent. The first one is obtained if the chain > rule is used, the seconde one if your rule is used. > You can also directly verify the equivalence by noting that the solution > to your definition is: f[x_]= f[1] x. > > Daniel > > Andres Corrada-Emmanuel wrote: > > Hello, > > > > I'm trying to define a derivative for a function that distributes: > > > > D[f[expr_],x_] ^:= f[D[expr,x]] > > > > This gives me: > > > > D[f[x^2],x] = f[2x] > > > > and > > > > D[f[x^4],x] = f[4x^3] > > > > But D[f[x^2] + f[x^4],x] = 2xf'[x^2] + 4x^3f'[x^4] instead of the > > desired: > > > > D[f[x^2] + f[x^4],x] = f[2x] + f[4x^3]. Why? And how do I get the desired > behaviour. > > > > -------------------------------------- > > Andres Corrada-Emmanuel > > Lecturer in Physics > > Physics Department > > University of Massachusetts at Amherst > > -------------------------------------- > > > > -------------------------------------- Andres Corrada-Emmanuel Lecturer in Physics Physics Department University of Massachusetts at Amherst and Program Manager 3-D Computer Vision and Image Understanding Division IAVO Research and Scientific --------------------------------------