flonk
flonk

Reputation: 3876

How can I force maple to perform chain differentiation?

When differentiating functions, it is often not clear to me, in which cases maple performs a chain differentiation and when it does not so.

Let's look at an example:

f := (x, y) -> r(x)*M(y);
g := (x, y) -> h(x, f(x,y));
A := D[2](g);

Then A(a,b) gives just

D[2](g)(a,b)

Question: Why does maple not perform the differentiation by going through the definitions applying the chain rule? And how can I get maple to do so?

Even more puzzling, in this simpler example, maple behaves as i wish:

f := 'f';
g := (x, y) -> h(x, f(x,y));
A := D[2](g);

Then A(a,b) returns

D[2](h)(a, f(a, b))*D[2](f)(a, b)

Maybe this helps to tackle the problem...

Upvotes: 1

Views: 1189

Answers (1)

acer
acer

Reputation: 7271

Is this useful?

restart:

f := (x, y) -> r(x)*M(y):
g := (x, y) -> h(x, f(x,y)):

#diff(g(x,y),y);
#convert(diff(g(x,y),y),D);

unapply(convert(diff(g(x,y),y),D),[x,y]);

              (x, y) -> D[2](h)(x, r(x) M(y)) r(x) D(M)(y)

Upvotes: 1

Related Questions