Another service from Omega

Computing Directional Derivatives


*****

EXERCISES

Problem 1:

Use the definition of directional derivative to compute the directional derivative of the function,

> with(linalg):f := (x,y) -> x/y: 'f(x,y)' = f(x,y);

                                 f(x, y) = x/y

at the point,

> r := vector([6,-2]):

in the direction of the vector,

> v := vector([-1,3])/sqrt(10):



Solution 1

Let's call Dvf the directional derivative. From the definition we have,

> Dvf := Limit('(f(r+h*v)-f(r))/h',h=0);

                                      f(r + h v) - f(r)
                        Dvf := Limit  -----------------
                               h -> 0         h

where in our case,

> p := evalm(r+h*v): Dvf := Limit((f(p[1],p[2])-f(r[1],r[2]))/h,h=0);

                                                 1/2
                                    6 - 1/10 h 10
                                    ----------------- + 3
                                                  1/2
                                    -2 + 3/10 h 10
                     Dvf :=  lim    ---------------------
                            h -> 0            h

which simplifies to,

> Dvf := Limit(simplify((f(p[1],p[2])-f(r[1],r[2]))/h),h=0);

                                               1/2
                                             10
                       Dvf :=  lim    8 ---------------
                              h -> 0                1/2
                                        -20 + 3 h 10

and the directional derivative is then,

> Dvf := limit((f(p[1],p[2])-f(r[1],r[2]))/h,h=0);

                                             1/2
                              Dvf := - 2/5 10

Ofcourse the formula with the grad gives the same answer,

> formula := innerprod(grad(f(x,y),[x,y]), v);

                                           1/2
                                         10    (y + 3 x)
                       formula := - 1/10 ---------------
                                                2
                                               y
> answer := subs({x=6,y=-2},formula);
                                               1/2
                             answer := - 2/5 10

Link to the commands in this file
Carlos Rodriguez <carlos@math.albany.edu>
Last modified: Fri Oct 15 10:13:13 EDT 1999