A Fast Guide to Maple and Partial Derivatives \302\251 Mike May, S.J., Saint Louis University, 2006 - maymk@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 done 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) getting 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+SSJnRzYiZio2JEkieEdGJUkieUdGJUYlNiRJKW9wZXJhdG9yR0YlSSZhcnJvd0dGJUYlLCYqJClGKCIiIyIiIkYxKiQpRikiIiRGMUYxRiVGJUYlRjE= print(); g(t,t); QyQtSSRjb3NHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2Iy1JJXNxcnRHRiU2IyokKUkjUGlHRiYiIiMiIiJGMQ== 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. QyQtSSVtcm93RzYjL0krbW9kdWxlbmFtZUc2IkksVHlwZXNldHRpbmdHSShfc3lzbGliR0YoNiYtSSNtaUdGJTYjUSJoRigtSSNtb0dGJTYzUSM6PUYoLyUlZm9ybUdRJmluZml4RigvJSZmZW5jZUdRJmZhbHNlRigvJSpzZXBhcmF0b3JHRjkvJSdsc3BhY2VHUS90aGlja21hdGhzcGFjZUYoLyUncnNwYWNlR0Y+LyUpc3RyZXRjaHlHRjkvJSpzeW1tZXRyaWNHRjkvJShtYXhzaXplR1EpaW5maW5pdHlGKC8lKG1pbnNpemVHUSIxRigvJShsYXJnZW9wR0Y5LyUubW92YWJsZWxpbWl0c0dGOS8lJ2FjY2VudEdGOS8lMGZvbnRfc3R5bGVfbmFtZUdRKTJEfklucHV0RigvJSVzaXplR1EjMTJGKC8lK2ZvcmVncm91bmRHUShbMCwwLDBdRigvJStiYWNrZ3JvdW5kR1EuWzI1NSwyNTUsMjU1XUYoLUYkNictRi02I1EhRigtRiQ2JS1GMTYzUSIoRigvRjVRJ3ByZWZpeEYoL0Y4USV0cnVlRihGOi9GPVEudGhpbm1hdGhzcGFjZUYoL0ZARmZvL0ZCRmRvRkNGRUZIRktGTUZPRlFGVEZXRlotRiQ2JS1GLTYjUSJ4RigtRjE2M1EiLEYoRjRGNy9GO0Zkby9GPVEkMGVtRigvRkBRM3Zlcnl0aGlja21hdGhzcGFjZUYoRkFGQ0ZFRkhGS0ZNRk9GUUZURldGWi1GLTYjUSJ5RigtRjE2M1EiKUYoL0Y1UShwb3N0Zml4RihGY29GOkZlby9GQFEydmVyeXRoaW5tYXRoc3BhY2VGKEZob0ZDRkVGSEZLRk1GT0ZRRlRGV0ZaLUYxNjNRJyZyYXJyO0YoRjRGN0ZhcEZicEY/RkFGQ0ZFRkhGS0ZNRk9GUUZURldGWi1GJDYnRmluLUYkNiVGaW4tSSVtc3VwR0YlNiVGW3AtSSNtbkdGJTYjUSIyRigvJTFzdXBlcnNjcmlwdHNoaWZ0R1EiMEYoRmluLUYxNjNRIitGKEY0RjdGOi9GPVEwbWVkaXVtbWF0aHNwYWNlRigvRkBGZXJGQUZDRkVGSEZLRk1GT0ZRRlRGV0ZaLUYkNiVGaW4tRmhxNiVGZnAtRltyNiNRIjNGKEZeckZpbkZpbkZpbkZpbiIiIg== 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. Exercise: 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 LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn
<Text-field style="Heading 1" layout="Heading 1">Producing Slice Curves of functions</Text-field> When we did cross sections of a graph before, we connected a function of two variables with a family of functions in one variables. This can be done by creating new functions. It can also be done by using a constant to fill in one of the variables. 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 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)"]); Exercise: 2) Plot the slice of the function func(x,y), which you defined in exercise 1 above, with y =2. LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn
<Text-field style="Heading 1" layout="Heading 1">Computing Partial Derivatives</Text-field> The partial derivative is computed by taking the derivative of a function of two variables, treating one of the variables 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 derivate and the partial derivative, it has 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 do the same computations in 2D math mode or by using the Expression palette. LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn QyQ+SSREZnlHNiItSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkdGJTYkSSJ4R0YlSSJ5R0YlRi4iIiI= print(); QyQtSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkc2IjYkSSJ4R0YpSSJ5R0YpRiwiIiI= print(); QyQtSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkc2IjYkSSN4MEdGKUkieUdGKUYsIiIi print(); QyQtSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkiZkc2IjYkSSJ4R0YpSSJ5R0YpRiwiIiI= print(); Exercise: 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. LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn 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. Dfy; QyRJJERmeUc2IiIiIg== print(); LUklZXZhbEclKnByb3RlY3RlZEc2JEkkRGZ5RzYiL0kieEdGJyIiIw== print(); LUklZXZhbEclKnByb3RlY3RlZEc2JC1GIzYkSSREZnlHNiIvSSJ4R0YpIiIjL0kieUdGKSIiJA== print(); QyQtSSRzaW5HNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2IywkKiYjIiIiIiIkRi1JI1BpR0YmRi1GLUYt print(); QyQtSSZldmFsZkclKnByb3RlY3RlZEc2Iy1JJHNpbkc2JEYlSShfc3lzbGliRzYiNiMsJComIyIiIiIiJEYwSSNQaUdGJUYwRjBGMA== print(); Exercise: 4) Evaluate both func and its partial with respect to y at (2,3). LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn