**Investigating Extreme Values in Maple**

**Copyright © 2001, 2002 by James F. Hurley, University of Connecticut Department of Mathematics, Unit 3009, Storrs CT 06269-3009. All rights reserved.**

The interactive version of this worksheet is in MSB 203 in the Math Lab folder inside the Server1 volume.

The graph of a function
:
** **
®
** **
usually reveals the approximate location of local extreme-value points. A local-maximum point is at the
*peak*
of some region of the graph that resembles a mountain. Similarly, a local-minimum point is at the
*pit*
of a portion of the graph that resembles a deep valley. Finally, a saddle point is at what appears to be a
*pass*
between two mountains. Exercise 4, Section 4.9, from James Hurley,
*Multivariable Calculus, *
Saunders, 1999) illustrates Maple's ability to check partial differentiation of
*f*
and solution of the equation
**Ñ**
*f*
(
*x*
,
*y*
) =
**0,**
as well as its usefulness in confirming the nature of stationary points graphically.

**Exercise 4**
. Consider the function
*f*
for which
*f*
(
*x, y) = *
. Find all stationary points, and classify each as a local-maximum point, a local-minimum point, or a saddle point.

**Solution. **
While it is good practice to carry out the differentiation by hand (to build facility for exams and later use of multivariable calculus), Maple provides an easy check of such calculations. For instance, the next routine checks the calculation of the partial derivatives of
*f*
with respect to
*x*
and
*y*
.
** **

Note that for Maple to handle vectors, such as
**Ñ**
*f*
(
*x*
,
*y*
)
, it is necessary to load its linear algebra library
linalg
. Also notice that vectors are entered within pointed brackets but with vertical bars rather than commas between coordinates. To compute partial derivatives, use the commands
diff(f(x, y), x)
and
diff(f(x, y), y)
.
Observe finally that to have Maple display the formulas it calculates, you must include the additional command to evaluate the gradient vector:
evalf(grad_f(x, y));

`> `
**with(linalg):
f := (x, y) -> x^3 + y^3 + 3*x^2 - 3*y^2 - 8;
grad_f := (x, y) -> < diff(f(x, y), x) | diff(f(x, y), y) >;
evalf(grad_f(x, y));
**

Warning, the protected names norm and trace have been redefined and unprotected

As you can see, Maple indeed can calculate
(
*x*
,
*y*
) and
(
*x*
,
*y*
)! It displays them in a vector surrounded by standard brackets. The stationary points of
*f*
are the solution points (
*a, b*
) of the equations
(
*x*
,
*y*
) = 0 and
(
*x*
,
*y*
) = 0. Hand solution of those equations yields the four points (0, 0), (0, 2), (
), and (
). You can check those stationary points by having Maple solve the vector equation
**Ñ**
*f*
(
*x*
,
*y*
) =
**0**
= ( 0, 0). The next routine illustrates this. Try it!

`> `
**f_x := (x, y) -> diff(f(x, y), x);
evalf(f_x(x, y));
f_y := (x, y) -> diff(f(x, y), y);
evalf(f_y(x, y));
solve({evalf(f_x(x, y))= 0, evalf(f_y(x, y))= 0});**

This output confirms the accuracy of the hand solution.

Although we could have Maple use the second-derivative test on the stationary points, it may be of greater interest to plot the graph of
*f*
, and examine it near those points. The next routine generates that graph over
*R*
= [
]
´
[
] = {(
*x*
,
*y*
) | -3 ²
*x *
² 3, -1 ²
* y *
² 3}.

`> `
**with(plots):
f := (x, y) -> x^3 + y^3 + 3*x^2 - 3*y^2 - 8:
surf := plot3d( f(x, y), x = -3..3, y = -1..3, axes = boxed ):
xaxis := spacecurve([t, 0, 0, t = -3..4, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -1..4, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -1..15, color = magenta]) :
labx := textplot3d([4.2, 0, -.2, `x`], color = magenta):
laby := textplot3d([0,4.2, -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 16, `z`], color = magenta):
display(surf, xaxis, yaxis, zaxis, labx, laby,labz);**

The chair-seat shaped figure suggests that the stationary points do correspond to saddle or extreme-value points, but it doesn't reveal the nature of the graph near those points. The next view, which is a rotated version of the above one, suggests that the point (0, 2) is a local minimum point. Similar rotation produces a view that suggests the origin and (
) are saddle points, and

(
) is a local-maximum point. The second-derivative test confirms those conclusions.

**Example 9.9(b)**
. Find and classify the stationary points of
*f*
if
*f*
(
*x*
,
*y*
) =
.

**Solution.**
Execute the following routine to find the partial derivatives of
*f*
and solve for the points (
*x*
,
*y*
) at which both are 0.

`> `
**f := (x, y) -> x^3 - 3*x*y^2 + y^2;
f_x := (x, y) -> diff(f(x, y), x);
evalf(f_x(x, y));
f_y := (x, y) -> diff(f(x, y), y);
evalf(f_y(x, y));
solve({evalf(f_x(x, y))= 0, evalf(f_y(x, y))= 0});**

This agrees with the results of hand calculation. The conventional 3-dimensional plot of the graph of
*f*
indicates that one or more of the stationary points are likely critical points.

`> `
**with(plots):
f := (x, y) -> x^3 - 3*x*y^2 + y^2:
surf := plot3d( f(x, y), x = -1..1, y = -1..1, axes = boxed ):
xaxis := spacecurve([t, 0, 0, t = -1..1, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -1..1, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -1..2, color = magenta]) :
labx := textplot3d([1.2, 0, -.2, `x`], color = magenta):
laby := textplot3d([0,1.2, -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 2.2, `z`], color = magenta):
display(surf, xaxis, yaxis, zaxis, labx, laby,labz);**

Maple's 3-dimensional level-curve routine reinforces that impression. The following plot strongly suggests, for instance, that the last stationary point (
) is a saddle point. Try this approach on the other stationary points.

`> `
**f := (x, y) -> x^3 - 3*x*y^2 + y^2;
contourplot3d( f(x, y),x = 0..1, y = -1..0, color = blue, labels = ["x", "y", "z"], axes = boxed);**