Computer Lab: Gradient Fields
The aim of this lab is to visualize some of the properties of the gradient, and to use them to interpret the behavior of a function of two variables.
Suppose
is a scalar-valued function of two variables, so
.
The gradient of f is the vector of functions:
.
The gradient of
at the point
is the vector:
points in the direction, from
,
in which the function
increases most rapidly.
is perpendicular to the contour or level curve for
through
.
A vector field
is simply a way of assigning, to points
in the plane, vectors
.
For example, the vector field
assigns the vector
to the point
.
Given a function
,
its gradient
is a vector field. For example, suppose
.
Then
(see immediately above), so
assigns the vector
to the point
We can picture vector fields by selecting a grid of points in the plane and
drawing the vector
at the point
.
Here is a Maple session which draws a combination of a
gradient plot and contour plot for the function
.
> with(plots):
> F:= x^2-2*x*y+3*y^2;
> P1:=contourplot(F,x=0..4,y=0..4,contours=20,
grid=[30,30]):
> P2:= gradplot(F,x=0..4,y=0..4,arrows=SLIM,
grid=[30,30]):
> display(P1,P2);

Note that the parameter grid = [30,30], in the contour
plot, determines how finely the contours are plotted (if they come out rough,
increase the numbers, but don't make them much bigger than 50). In the
gradient plot, the grid determines how many arrows are plotted. Both of the
plot commands end in a colon (":") so they don't
display anything, but save their data in variables P1
and P2, which are plotted simultaneously in the
display command.
Combined gradient and contour plots can be helpful in classifying critical points (places where the gradient is zero). These are of three types:
Maxima: nearby gradient vectors all point toward the critical point (function increasing)
Minima: nearby gradient vectors all point away from critical point (function decreasing)
Saddles: some nearby gradients point toward, others away.
Draw a gradient/contour plot for the function
in the rectangle
(usually written as simply
).
Use this to locate, approximately, the critical points. Classify them: max,
min or saddle; explain how you know.
Do the same as exercise 1, except use the rectangle
and the function:
.
Do the same as exercise 1, except use the rectangle
and the function:
.
Do the same as exercise 1, except use the rectangle
and the function:
