2
$\begingroup$

I am taking the derivative of a function with respect to another function, e.g.

D[g[f[x,y]],f[x,y]]

This outputs g'(f(x,y)), as expected. How can I specify a rule for this derivative?

I've tried the following:

Derivative[g[f[x_,y_]][f[x_, k_]]] := f[y, k]

but apparently this isn't the output of D[].

Any ideas?

$\endgroup$
2
  • $\begingroup$ Try: Derivative[g[f[x_, y_]][f[x_, k_]]] := g'[f[y, k]] $\endgroup$ Jan 29 at 13:20
  • $\begingroup$ This doesn't appear to do anything.... $\endgroup$
    – Akoben
    Jan 29 at 14:04

1 Answer 1

2
$\begingroup$

Assuming that you have a random expression

expr = D[g[f[x, y]], f[x, y]] + 2 x + 2 f[x, y] + g[f[x, y]] + 
   Log[D[g[f[x, y]], f[x, y]]];

that looks like this

expr

exp

you can write a replacement rule like so:

rule = Derivative[1][g][f[x, y]] -> 
    HHH[x, y]; 

and then

expr /. rule

gives

res

To understand the above, I suggest that you take a look at the FullForm of the expression for which you wanted to set a rule originally, i.e D[g[f[x, y]], f[x, y]] // FullForm

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.