Re: Defining a derivative that distributes for a function

• To: mathgroup at smc.vnet.net
• Subject: [mg64243] Re: Defining a derivative that distributes for a function
• From: David Bailey <dave at Remove_Thisdbailey.co.uk>
• Date: Wed, 8 Feb 2006 03:53:30 -0500 (EST)
• References: <ds9mqp\$48\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```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.
>
> --------------------------------------
> Lecturer in Physics
> Physics Department
> University of Massachusetts at Amherst
> --------------------------------------
>

The built-in operation of D (and Integrate) can make it hard to add
extensions like this. One solution is to define your own derivative
operation - say DD - and define some recursive rules for that. One of
those rules might make use of the built-in D to mop up all the usual stuff.

David Bailey
http://www.dbaileyconsultancy.co.uk

```

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