Directional Derivatives

A similar result involves the derivative in the direction of any vector. Note that the partial derivative with respect to x is the derivative in the x (or i or [1,0,0]) direction. We can take the derivative in the direction of any vector u. All we ask is that u be a unit vector, that is, it has length 1. You saw the theory in Calc II, here is the result:
Du(f)=gradient(f).u (Du(f) stands for the directional derivative of f in the direction of u.)

To find the derivative of x^2 y + y^2 z + z^2 x at the point (1,0,1) in the direction of [0,3,-1], do the following:

In[56]:=

  Clear[u,v,f]
  f[x_,y_,z_]:=x^2 y + y^2 z + z^2 x;
  v={0,3,-1}
  u=v/norm3[v]
  

Out[56]=

  {0, 3, -1}

Out[57]=

         3           1
  {0, --------, -(--------)}
      Sqrt[10]    Sqrt[10]

In[58]:=

  grad3[f][x,y,z].u

Out[58]=

     2                2
    y  + 2 x z    3 (x  + 2 y z)
  -(----------) + --------------
     Sqrt[10]        Sqrt[10]

In[59]:=

  grad3[f][x,y,z].u /.{x->1, y->0,z->1}

Out[59]=

        2       3
  -Sqrt[-] + --------
        5    Sqrt[10]

To find the derivative of f(x,y,z) above at (1,-3,2) in the direction of the curve r(t)=t^2 i +3t j + (1-t^3) k, do the following:

The direction of a curve at a point is given by its derivative at that point! To be at the point (1,-3,2) we need t=-1 in r(t).

In[60]:=

  r[t_]:={t^2,3 t,1-t^3}

In[61]:=

  dir=D[r[t],t]/.t->-1
  u=dir/norm3[dir]

Out[61]=

  {-2, 3, -3}

Out[62]=

         2       3         -3
  {-Sqrt[--], --------, --------}
         11   Sqrt[22]  Sqrt[22]

In[63]:=

  grad3[f][x,y,z].u

Out[63]=

       2                2
  -3 (y  + 2 x z)   3 (x  + 2 y z)        2             2
  --------------- + -------------- - Sqrt[--] (2 x y + z )
     Sqrt[22]          Sqrt[22]           11

In[64]:=

  grad3[f][x,y,z].u /.{x->1, y->-3 ,z->2}

Out[64]=

         2            11       39
  2 Sqrt[--] - 3 Sqrt[--] - --------
         11           2     Sqrt[22]

Up to The Gradient