next up previous
Next: About this document ... Up: lab_template Previous: lab_template


Contour lines, directional derivatives, and the gradient

Getting Started

To assist you, there is a worksheet associated with this lab that contains examples. You can copy that worksheet to your home directory with the following command, which must be run in a terminal window, not in Maple.

cp /math/calclab/MA1024/Pardiff_grad_start.mws ~


Contour lines

For functions of two variables in Cartesian coordinates, the graph is a set of points $(x,y,f(x,y))$ in three-dimensional space. For this reason, visualizing functions of two variables is usually more difficult. The simplest way of describing a surface in Cartesian coordinates is as the graph of a function $z = f(x,y)$ over a domain, e.g. a set of points in the $xy$ plane. The domain can have any shape, but a rectangular one is the easiest to deal with. Another way of representing a surface $z = f(x,y)$ is through the use of level curves. The idea is that a plane $z=c$ intersects the surface in a curve. The projection of this curve on the $xy$ plane is called a level curve. A collection of such curves for different values of $c$ is a representation of the surface called a contour plot.

Directional derivatives

The partial derivatives $\partial F /\partial x$ and $\partial F
/\partial y$ of $F$ can be thought of as the rate of change of $F$ in the direction parallel to the $x$ and $y$ axes, respectively. The directional derivative $D_{\mathbf{u}}F(\mathbf{p})$, where $\mathbf{u}$ is a unit vector, is the rate of change of $F$ in the direction $\mathbf{u}$. There are several different ways that the directional derivative can be computed. The method most often used for hand calculation relies on the gradient, which will be described below. It is also possible to simply use the definition

\begin{displaymath}D_{\mathbf{u}}F(\mathbf{p}) = \lim_{h \rightarrow 0}
\frac{F(\mathbf{p}+h\mathbf{u}) - F(\mathbf{p})}{h} \end{displaymath}

to compute the directional derivative. However, the following computation, based on the definition, is often simpler to use.

\begin{displaymath}D_{\mathbf{u}}F(\mathbf{p}) = \left. \frac{d}{dt}
F(\mathbf{p}+t\mathbf{u})   \right\vert _{t=0} \end{displaymath}

One way to think about this that can be helpful in understanding directional derivatives is to realize that $\mathbf{p}+t\mathbf{u}$ is a straight line in the $x,y$ plane. The plane perpendicular to the $x,y$ plane that contains this straight line intersects the surface $z =
F(x,y)$ in a curve whose $z$ coordinate is $F(\mathbf{p}+t\mathbf{u})$. The derivative of $F(\mathbf{p}+t\mathbf{u})$ at $t=0$ is the rate of change of $F$ at the point $\mathbf{p}$ moving in the direction $\mathbf{u}$.

The Gradient

The gradient of $F$, written $\nabla F$, is most easily computed as

\begin{displaymath}\nabla F(\mathbf{p}) = \frac{\partial F}{\partial x}(\mathbf{...
...thbf{i} + \frac{\partial F}{\partial y}(\mathbf{p}) \mathbf{j} \end{displaymath}

As described in the text, the gradient has several important properties, including the following.


  1. Consider the following function.

    \begin{displaymath}f(x,y) = \frac{x-y+1}{1+x^2+y^2}\end{displaymath}

    First, plot the graph of this function over the domain $-3 \leq x
\leq 3$ and $-3 \leq y \leq 3$ using the plot3d command. Then use the contourplot command to generate a contour plot of $f$ over the same domain having 20 contour lines.
    What does the contour plot look like in the regions where the surface plot has a steep incline? What does it look like where the surface plot is almost flat?
    What can you say about the surface plot in a region whe re the contour plot looks like a series of nested circles?

  2. Consider again the function $f$ from the first exercise. Using either method from the Getting Started worksheet, compute the directional derivative of $f$ at the point $x=1$, $y= -1$ in the three directions below.
    $\mathbf{u} = \langle 1, 1 \rangle$
    $\mathbf{u} = \langle 1, 0 \rangle$
    $\mathbf{u} = \langle 0, 1 \rangle$

  3. Using the method from the Getting Started worksheet, plot the gradient field and the contours of $f$ on the same plot. Use the domain of $0 \leq x \leq 3$ and $-3 \leq y \leq 0$. Use 20 contours and a 20 by 20 gradient field. Can you use this plot to explain the values for the directional derivatives you obtained in the previous exercises? By explaining the values, I only mean can you explain what kind of surface it is and why the values were positive, negative, or zero in terms of the contours and the gradient field?

next up previous
Next: About this document ... Up: lab_template Previous: lab_template
Jane E Bouchard