Next: About this document ...
Up: lab_template
Previous: lab_template
Subsections
The purpose of this lab is to acquaint you with using Maple to compute
partial derivatives, directional derivatives, and the gradient.
To assist you, there is a worksheet associated with this lab that contains examples and even solutions to some of the exercises. You can copy that worksheet to your home directory by going to your computer's Start me nu and choose run. In the run field type:
\\storage\academics\math\calclab\MA1024\Pardiff_grad_start_A18.mw
Remember to immediately save it in your own home directory. Once you've copied and saved the worksheet, read through the background on the internet and the ba ckground of the worksheet before starting the exercises.
For a function
of a single real variable, the derivative
gives information on whether the graph of
is increasing or
decreasing. Finding where the derivative is zero was important in
finding extreme values. For a function
of two (or more)
variables, the situation is more complicated.
A differentiable function,
, of two variables has two partial
derivatives:
and
. As you have learned in class, computing partial derivatives is
very much like computing regular derivatives. The main difference is
that when you are computing
, you must treat
the variable
as if it was a constant and vice-versa when computing
.
The Maple commands for computing partial derivatives are D
and diff. The Getting Started worksheet has examples
of how to use these commands to compute partial derivatives.
The partial derivatives
and
of
can be thought of as the rate of change of
in
the direction parallel to the
and
axes, respectively. The
directional derivative
, where
is a unit vector, is the rate of change of
in the
direction
. 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
to compute the directional derivative. However, the following
computation, based on the definition, is often simpler to use.
One way to think about this that can be helpful in understanding
directional derivatives is to realize that
is
a straight line in the
plane. The plane perpendicular to the
plane that contains this straight line intersects the surface
in a curve whose
coordinate is
. The derivative of
at
is the rate of change of
at
the point
moving in the direction
.
Maple doesn't have a simple command for computing directional
derivatives. There is a command in the tensor package that
can be used, but it is a little confusing unless you know something
about tensors. Fortunately, the method described above and the method
using the gradient described below are both easy to implement in
Maple.
The gradient of
, written
, is most easily computed as
As described in the text, the gradient has several important
properties, including the following.
Maple has a fairly simple command grad in the linalg
package (which we used for curve computations). Examples of computing
gradients below show how to compute directional derivatives and
plot the gradient field.
>with(linalg):
>with(plots):
>f:=(x,y)->x^2+y^2
>grad(f(x,y),[x,y])
>eval(innerprod(grad(f(x,y),[x,y]),[sqrt(2)/2,sqrt(2)/2]),{x=1,y=-2})
>p1 := fieldplot(grad(f(x,y),[x,y]),x=-2..2,y=-2..2,arrows=SLIM,grid=[20,20],fieldstrength=fixed):
>p2 := contourplot(f(x,y),x=-2..2,y=-2..2,contours=20):
>display(p1,p2)
In single-variable
calculus, we found that we could locate candidates for local extreme
values by finding points where the first derivative vanishes. For
functions of two dimensions, the condition is that both first order
partial derivatives must vanish at a local extreme value candidate
point. Such a point is called a stationary point. It is also one of
the three types of points called critical points.
Note carefully that the condition does not say that a point where the partial
derivatives vanish must be a local extreme point. Rather, it says that
stationary points are candidates for local extrema. Just as was the case
for functions of a single variable, there can be stationary points that
are not extrema. For example, the saddle surface
has a stationary point at the origin, but it is not a local extremum.
Each critical point
can be classified as a local maximum, local minimum, or a saddle point using the second-partials test:
If
and
then
is a local minimum.
If
and
then
is a local maximum.
If
then
is a saddle point.
If
then no conclusion can be made. The examples below show how to use Maple to simplify these tasks to classify a point like
as a local maximum, local minimum, or saddle point.
>evalf(D[1,1](f)(0,0)*D[2,2](f)(0,0)-D[1,2](f)(0,0)^2)
>evalf(D[1,1](f)(0,0)
For the function
,
- Using the method from the Getting Started worksheet, compute the directional derivative of
at the point
in each of the directions below. Explain your results in terms of being positive, negative or zero and what that tells about the surface at that point in the given direction.
-
-
-
- Now, find the directional derivative at each of the points
and
in the first two directions given in exercise 1. What do your results suggest about the surface at these points?
- Plot the gradient field and the contours of
on the same plot over the intervals
and
. Use 30 contours, a
grid and fieldstrength=fixed for the gradient plot. Classify each point in the previous exercise,
and
as local maximum, local minimum or saddle point based on contours and gradient plots.
- Use the second derivative test to confirm your classification of each point in exercise 3.
Next: About this document ...
Up: lab_template
Previous: lab_template
Dina J. Solitro-Rassias
2018-09-17