**Bug fix:**
Problems with D

When a function
**f**
is defined using a second user-defined function
**g**
,
**D(f)**
doesn't work: it returns unevaluated. It does work if the function
**g**
is undefined.

Here the function
**f**
is defined using the undefined function
**g**
.

`> `
**f:= x -> x + g(x); g:='g':
D(f);**

But now here it is after
**g**
has been defined.

`> `
**g:= x -> x^2; D(f);**

What Maple looks for is a procedure named
**`diff/g`**
that performs the differentiation of
**g**
.

The command
**makediff(g)**
produces the procedure
**`diff/g`**
, allowing
**D(f)**
to work for procedures
**f**
defined using
**g**
.

The command
**fixD(f)**
applies
**makediff**
to all user-defined procedures referenced in
**f**
, thus allowing
**D(f)**
to work.

This works only for global procedures, not local procedures or module exports.

This function is part of the
**Maple Advisor Database.**

**Examples:**

Defining
**f**
using defined function
**g**
:

`> `
**f:= x -> x*g(x^2);
g:= x -> 1 + x^2;**

**D(f)**
does not work:

`> `
**D(f);**

Using
**makediff(g)**
to make this work:

`> `
**makediff(g); D(f);**

Another function
**h**
defined using both
**f**
and
**g**
.

`> `
**h:= (x,y) -> f(x) + g(y); D[1](h);**

Using
**fixD(h)**
to make
**D[1](h)**
work:

`> `
**fixD(h); D[1](h);**

**See also:**

**Maple Advisor Database **
R. Israel, 2001