2 (4 points).

a) Compute the gradient vector field of the function f(x,y,z) = x ln(y) + z
ln(x).

Solution. The three components are:

In[3]:=

  f[x_,y_,z_] := x Log[y] + z Log[x]

In[4]:=

  { D[x Log[y] + z Log[x],x],
    D[x Log[y] + z Log[x],y],
     D[x Log[y] + z Log[x],z]}

Out[4]

The set on which this is defined is the set of all {x,y,z} such that x
and y are positive. This is an open set (the set get arbitrarily close to where x = 0 or
y = 0, but does not include these boundary points. It is also connected,

c) Calculate the integral of grad f dotted with dx along the straight line
from (1,1,1) to (1,2,1).

Solution. The easy way to do this is to know that the integral equals f(1,2,1)
- f(1,1,1):

In[5]:=

  f[1,2,1] - f[1,1,1]

Out[5]=

  Log[2]

Alternatively, we could set up a line integral. The straight line can be
parametrized as

In[6]:=

  Clear[x,y,z]

In[7]:=

  x[t_] := 1
  y[t_] := 1 + t
  z[t_] := 1

The time t will go from 0 to 1. We take the dot product of F with the
velocity:

In[8]:=

  { D[x Log[y] + z Log[x],x],
    D[x Log[y] + z Log[x],y],
     D[x Log[y] + z Log[x],z]}.{x'[t],y'[t],z'[t]} \
     /. {x -> 1,y -> 1+t, z -> 1} 
         

Out[8]=

    1
  -----
  1 + t

In[9]:=

  Integrate[%, {t,0,1}]

Out[9]=

  Log[2]

What a coincidence, the same number!




Up to Test 3 solutions