# Gradient of a function at a point

I have defined a function

f[x_, y_, z_] := x*y^2 - y *z^2


and I want to evaluate its gradient at the point (0,-2,1) I tried Grad[f[x,y,z], {0,-2,1}] and that just gave me back the function with a nabla in front of it. I tried Grad[f[0, -2, 1], {x, y, z}]. That of course gives zero because x,y and z are constant, right?

f[x_, y_, z_] := x*y^2 - y*z^2

Grad[f[x, y, z], {x, y, z}]


{y^2, 2 x y - z^2, -2 y z}

%/. {x -> 0, y -> -2, z -> 1}


{4, -1, 4}

Or you could make a second function

f[x_, y_, z_] := x*y^2 - y*z^2

(*{4, -1, 4}*)


You could also use Derivative:

Derivative[##][f][0, -2, 1] & @@@ IdentityMatrix[3]


$\left\{f^{(1,0,0)}(0,-2,1),\,f^{(0,1,0) }(0,-2,1),\,f^{(0,0,1)}(0,-2,1)\right \}$

f[x_, y_, z_] := x*y^2 - y*z^2

{4, -1, 4}