A Fast Guide to Maple and Partial Derivatives \302\251 Mike May, S.J., Saint Louis University, 2006 - maymk@slu.edu Edited by Russell Blyth - blythrd@slu.edu restart;
<Text-field style="Heading 1" layout="Heading 1">Preliminaries - Establishing Functions</Text-field> To use Maple to find partial derivatives we first need to be able to define functions. We start with the simple function f taking (x,y) to x^2 + y^3. This can be defined in a number of ways. 1) Use the insert menu to insert an execution group after the cursor (command-J), insert Maple input (command-M) to get a vertical cursor and red type, and define the function with the syntax "f := (x,y) -> x^2+y^3;" We then evaluate the function for a particular (x,y). f := (x,y) -> x^2+y^3-x*y; f(2,z); 2) Use the same method in 2-D math mode. (On a new line insert 2-D Math, command-R.) Note that Maple turns the dash-greater than combination into an arrow. QyQ+SSJnRzYiZio2JEkieEdGJUkieUdGJUYlNiRJKW9wZXJhdG9yR0YlSSZhcnJvd0dGJUYlLCYqJDkkIiIjIiIiKiQ5JSIiJEYxRiVGJUYlRjE= print(); g(t,t); QyQtSSRjb3NHNiI2Iy1JJXNxcnRHRiU2IyokSSNQaUclKnByb3RlY3RlZEciIiMiIiI= 3) Use the 2-D math mode and the Expression palette to the left. Click on the expression f:=(a,b)->z, then navigate through the entries with tabs to fill in the expression. QyQ+SSJoRzYiZio2JEkieEdGJUkieUdGJUYlNiRJKW9wZXJhdG9yR0YlSSZhcnJvd0dGJUYlLCYqJDkkIiIjIiIiKiQ5JSIiJEYxRiVGJUYlRjE= print(); QyQtSSJoRzYiNiRJImtHRiVJIm1HRiUiIiI= print(); For the exercises, instead of defining a function named f, you will define a function named func, and you will use func throughout the exercises.
<Text-field style="Heading 2" layout="Heading 2">Exercise</Text-field> 1. Using each of the three methods described above, define the function func(x,y)=sin(x^2+y^3) and evaluate at (x,y)=(sqrt(Pi)/4,0). LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn
<Text-field style="Heading 1" layout="Heading 1">Producing slice curves of functions</Text-field> We can graph a cross sections of a function of two variables by using a constant to fill in one of the variables, thus producing a function of the other variable. f := (x,y) -> x^2+y^3-x*y; x0 := 1: y0 := 2: f1 := x -> f(x,y0); f2 := y -> f(x0,y); plot([f1(t), f2(t)], t=-2..2, color=[red, green], legend = ["f1(t)", "f2(t)"]); We can also plot a family of slices of a function. A function of two variables can be regarded as the union of a continuous collection of such slices in one or other of the two input variables. f := (x,y) -> x^2+y^3-x*y; plot([f(x,-1), f(x,0.5), f(x,1)],x=-3..3, color=[red,green,blue], legend=["f(x,-1)", "f(x,0.5)", "f(x,1)"]);
<Text-field style="Heading 2" layout="Heading 2">Exercise</Text-field> 2. Plot the slice of the function func(x,y), which you defined in Exercise 1 above, with y =2. LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn
<Text-field style="Heading 1" layout="Heading 1">Computing Partial Derivatives</Text-field> The partial derivative of a function of two variables is computed by taking the derivative with respect to one of the other variables while the other variable is treated as a constant. In Maple, this is done with the diff command. It should be noted that the diff command has an "inert" version, Diff. Applying both commands we see that while Maple uses the same command for the derivative and the partial derivative, it uses a different symbol for the partial derivative. f := (x,y) -> x^2+y^3-x*y; f(x,y); Dfx := diff(f(x,y),x); Df1x := diff(f(x,y0),x); Df1xa := diff(f1(x),x); Diff(f(x,y),x); Diff(f1(x),x); Diff(f(x,y0),x); We can enter the same computations in 2D math mode or by using the Expression palette. LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn QyQ+SSREZnlHNiItSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkdGJTYkSSJ4R0YlSSJ5R0YlRi4iIiI= print(); QyQtSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkc2IjYkSSJ4R0YpSSJ5R0YpRiwiIiI= print(); QyQtSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkc2IjYkSSN4MEdGKUkieUdGKUYsIiIi print(); QyQtSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkc2IjYkSSJ4R0YpSSJ5R0YpRiwiIiI= print();
<Text-field style="Heading 2" layout="Heading 2">Exercise</Text-field> 3. Compute the partials of the function func(x,y), which you defined in exercise 1 above, both with respect to x and with respect to y.
Finally, we would like to evaluate an expression at specific values. We use the eval command for this. The syntax is eval(thing to be evaluated, set of values to be used); This can be done either by typing or using the palette. To get a decimal representation we use the evalf command. QyRJJERmeUc2IiIiIg== print(); QyQtSSVldmFsRyUqcHJvdGVjdGVkRzYkSSREZnlHNiI8JC9JInhHRigiIiMvSSJ5R0YoIiIkIiIi print(); LUklZXZhbEclKnByb3RlY3RlZEc2JEkkRGZ5RzYiL0kieEdGJyIiIw== print(); LUklZXZhbEclKnByb3RlY3RlZEc2JC1GIzYkSSREZnlHNiIvSSJ4R0YpIiIjL0kieUdGKSIiJA== print(); LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbWlHRiQ2JVEkc2luRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkobWZlbmNlZEdGJDYkLUYjNiUtRiw2JVEhRidGL0YyLUkmbWZyYWNHRiQ2KC1GLDYlUSNQaUYnRi9GMi1JI21uR0YkNiRRIjNGJy9GM1Enbm9ybWFsRicvJS5saW5ldGhpY2tuZXNzR1EiMUYnLyUrZGVub21hbGlnbkdRJ2NlbnRlckYnLyUpbnVtYWxpZ25HRk4vJSliZXZlbGxlZEdRJmZhbHNlRidGOkZHLUkjbW9HRiQ2MFEiO0YnRkcvJSZmZW5jZUdGUy8lKnNlcGFyYXRvckdGMS8lKXN0cmV0Y2h5R0ZTLyUqc3ltbWV0cmljR0ZTLyUobGFyZ2VvcEdGUy8lLm1vdmFibGVsaW1pdHNHRlMvJSdhY2NlbnRHRlMvJSVmb3JtR1EmaW5maXhGJy8lJ2xzcGFjZUdRJDBlbUYnLyUncnNwYWNlR1EvdGhpY2ttYXRoc3BhY2VGJy8lKG1pbnNpemVHUSIxRicvJShtYXhzaXplR1EpaW5maW5pdHlGJy1JJ21zcGFjZUdGJDYmLyUnaGVpZ2h0R1EmMC4wZXhGJy8lJndpZHRoR1EmMC4wZW1GJy8lJmRlcHRoR0ZkcC8lKmxpbmVicmVha0dRKG5ld2xpbmVGJ0Y6 print(); QyQtSSZldmFsZkclKnByb3RlY3RlZEc2Iy1JJHNpbkc2IjYjLCRJI1BpR0YlIyIiIiIiJEYu print(); print(); print();
<Text-field style="Heading 2" layout="Heading 2">Exercise</Text-field> 4. Evaluate both func and its partial with respect to y at (2,3).
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn