2
$\begingroup$

I was working through some physics equations and came to a dead stop when I couldn't get the Derivative operator to work on equations with 2 variables. An example I striped the problem down to is below. What subtle coding principal am I missing about symbolics? I have the documentation open on the other screen and it's not exactly clear how to work with pairs as inputs to functions. I looked at everything with Fullform and didn't see anything too unexpected. Is there an explanation as to what's going on?

h[h_] := h^2 + 2 h +3
h'[u]

2+2 u

(returns as expected)

f[{x_,y_}] := x^4 + y^4
Derivative[1][f][{x,y}]    
f'[{x,y}]

f′[{x,y}]

f′[{x,y}]

$\endgroup$
  • $\begingroup$ Better use D for total derivatives, e.g. D[f[{x, y}], {{x, y}, 1}] and D[f[{x, y}], {{x, y}, 2}]. $\endgroup$ – Henrik Schumacher Nov 17 '18 at 7:37
5
$\begingroup$

When a function has 2 arguments (not a single list argument), use:

f[x_, y_] := x^4 + y^4
Derivative[1, 0][f][x, y]
Derivative[0, 1][f][x, y]

4 x^3

4 y^3

$\endgroup$
  • $\begingroup$ Ah. So I was miss reading the documentation. Thank you. $\endgroup$ – BBirdsell Nov 17 '18 at 16:30
1
$\begingroup$

Here are two approaches. The first requires perhaps more tolerance for "noisy" notation. Note that I did not use a vector argument. If you must, the notation will be correspondingly "noisier".

Clear[f, x, y]
Dt[f[x, y]]
Grad[f[x, y], {x, y}].{dx, dy}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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