MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Defining a derivative that distributes for a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64258] Re: [mg64222] Defining a derivative that distributes for a function
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 8 Feb 2006 03:53:52 -0500 (EST)
  • References: <200602070835.DAA29828@smc.vnet.net> <86E64C13-5B5B-4F1F-B1E0-9608B9605220@mimuw.edu.pl>
  • Sender: owner-wri-mathgroup at wolfram.com

On 7 Feb 2006, at 17:54, Andrzej Kozlowski wrote:

>
> On 7 Feb 2006, at 08:35, 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.
>
> The reason is that the pattern in the rule you have defined does  
> not match the expression you are differentiating so the built-in  
> rules for D (distributivity with respect to addition and the chain  
> rule) are triggered off and once they are applied it is too late to  
> apply your rule.

In fact the above is not quite accurate. If distributivity with  
respect to addition was applied first followed by the chain rule of  
course your rule would match. It seems it is just the chain rule for  
the function Plus[f[x^2],f[x^4]] that is applied, which never gives  
your rule a chance to match.

Andrzej Kozlowski


  • Prev by Date: Re: MathGL3d and Mathematica 5.3
  • Next by Date: Re: Defining a derivative that distributes for a function
  • Previous by thread: Defining a derivative that distributes for a function
  • Next by thread: Re: Defining a derivative that distributes for a function