Mathematics 41, section 1 – Analysis 3 Lab Day 4 – Analyzing graphs with partial derivatives February 24, 1998

Background

Today, we will continue our study of partial derivatives for f(x, y) using Maple, and investigate several graphs z = f(x, y) thinking of the information contained in \frac{∂f}{∂x}(x, y) and \frac{∂f}{∂y} (x, y).

New Maple Commands

1. Symbolic partial derivatives

You can compute partial derivatives for functions defined by formulas in Maple by using the D command. Say you have defined

                      f:=(x,y) -> x^2*exp(x^2 - y^2);

previously in a Maple session. Then you can compute the first order partial derivative of f with respect to x by entering a command like this:

                             dfdx := D[1](f);

This computes the partial derivative of f with respect to variable number 1, that is, x, and defines a new function called dfdx, whose value at (x, y) is \frac{∂f}{∂x}(x, y). You can evaluate at (1, 2) (for instance) by entering dfdx(1,2);. Your output should be

4e^{(−3)}

if you try this. Similarly the function \frac{∂f}{∂y} (x, y) will be the output of D[2](f). What would you do to get the second order partial derivatives

\frac{∂^{2}f}{∂x^{2}} , \frac{∂^{2}f}{∂x∂y} , \frac{∂^{2}f}{∂y∂x}, \frac{∂^{2}f}{∂y^{2}} ?

(Recall that

\frac{∂^{2}f}{∂x∂y} = \frac{∂}{∂x} (\frac{∂f}{∂y} )

for instance.) If you can’t see what to do, try looking at the online Maple Help for the D command.

2. Combining two or more plots

Today we will be building up several “composite” Maple graphics displays combining plots of graphs z = f(x, y) produced with plot3d and plots of parametric curves produced using spacecurve. This can be done via the display3d command in the plots package. To use all commands in plots you will need to start your session by entering

                               with(plots);

Here is an example of combining a surface plot and a curve plot. First we generate the plot of z = x^{2} − y^{2} for (x, y) ∈ [−3, 3] × [−3, 3], and assign the output to the variable P1.

                   P1:=plot3d(x^2-y^2,x=-3..3,y=-3..3):

(The colon at the end of the input line suppresses the output, which is Maple’s internal form of the graph. To see why I did that, try replacing the colon with a semicolon and pressing RETURN again on that line to reexecute!) Then, we generate a plot of the parametric curve α(t) = (t, t^{2}, t^{3}) for t ∈ [−2, 2], drawn with a relatively thick line and in black for contrast, and put the results into the variable P2:

       P2:=spacecurve([t,t^2,t^3,t=-2..2],color=black,thickness=2):

Finally, we display both graphs together:

                            display3d({P1,P2});

(Here of course, you do want to see the output, presumably.) Maple is smart enough about these plots to combine the scales correctly and show the curve and surface in their proper relative positions! Look at this one for a while until you see how the curve and the surface are intersecting. How many intersection points are there?

Any number of different 3D plots can be displayed together in this way by assigning each to a variable, then putting the set or list of plot variables names in the display3d command.

Lab Questions

A) Consider the graph of f(x, y) = (x^{2} + 1)y + sin(x) on [−2, 2] × [−2, 2].

1) Use D to compute \frac{∂f}{∂x} and \frac{∂f}{∂y} at a general point (x, y) and check your results by hand. What does this say about the slopes of the tangents to the slices of the graph by the planes x = −1 and y = 2 at the point where they cross (that is, at the point (−1, 2, f(−1, 2)) on the graph)?

2) The slice in the plane y = 2, for instance, is the parametric curve α(x) = (x, 2, f(x, 2)) for x ∈ [−2, 2]. The slice in the plane x = −1 is the parametric curve β(y) = (−1, y, f(−1, y)) for y ∈ [−2, 2]. Generate a composite plot showing the graph together with the two slices. (Suggestion: For visibility again, use the option style = PATCHNOGRID in the plot3d command that generates the graph, and use options as in the example above for the spacecurve commands.)

3) What is the sign of \frac{∂^{2}f}{∂x^{2}} (−1, 2)? What does this tell you about the graph at (−1, 2, f(−1, 2))?

4) What is the sign of \frac{∂^{2}f}{∂y^{2}} (−1, 2)? What does this tell you about the graph at (−1, 2, f(−1, 2))?

5) What is the sign of \frac{∂^{2}f}{∂x∂y} (−1, 2)? What does this tell you about the graph at (−1, 2, f(−1, 2))?

6) Find the equation of the plane in R^{3} containing the point (−1, 2, f(−1, 2)) and the vectors α′(−1) and β′(2).

7) Generate another composite plot showing the graph and the plane from part 6 together. (Suggestion: Use a smaller domain of x and y values in plotting the plane.)

B) Repeat parts 1 - 7 of question A for the function f(x, y) = x^{3} − xy^{2} + xy at the point (x, y) = (−2, −2).

Assignment

Lab write-ups due Tuesday, March 3.