{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 256 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 43 "Functions of Several Var iables\nOctober 2008" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "We will use the function " }{XPPEDIT 18 0 "f(x,y ) = 4*x/(x^2+y^2+1);" "6#/-%\"fG6$%\"xG%\"yG*(\"\"%\"\"\"F'F+,(*$F'\" \"#F+*$F(F.F+F+F+!\"\"" }{TEXT -1 68 " in the computations below, an d we define it now once and for all." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "f := (x,y) -> 4*x/(x^2+y^2 +1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 115 "Once we define f in the function syntax (with \" -> \") \+ we can evaluate and manipulate f in the usual way. Examples:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "f(2,1);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 7 "f(a,b);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "f(t,t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 6 "Plot3d" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 200 "The easiest way to graph a function of two variables is using the plot3d command. It will result in a surface in three dimensions. Yo u need to state the function and the ranges of the two variables." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "plot3d(f,-3..3,-3..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 142 "We could also graph f as an expression. \+ Notice the slight difference in the plotting statement below (of cour se, the graphs remain the same)." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "plot3d(f(x,y),x=-3..3,y=-3..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 207 "Let's add some bells and whistles. Axes=normal adds the coordina te axes, we change the style, we select 3-d viewing region (this lis l ike setting the window on a graphing calculator) and we give it a titl e." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 90 "plot3d(f,-4..4,-4..4, axes=no rmal, style=surface, view=[-4..4,-4..4,-4..4],title=' wow ');" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "Suppose we want to also show the p lane " }{XPPEDIT 18 0 "z = x-y;" "6#/%\"zG,&%\"xG\"\"\"%\"yG!\"\"" } {TEXT -1 43 " in the same figure. First we define it," }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "p := (x,y) -> x-y;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 64 "and now we are ready to plot it along with the original surface." }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 92 "plot3d([f,p],-4..4,-4..4, axes=normal, style=[ wireframe,surface], view=[-4..4,-4..4,-4..4]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 231 "There is a second option to show two graphs in the \+ same figure. First you define the graphs one at a time (use : rather \+ than ; ), and then you display them simultaneously. This methods requ ires that you activate the plot package." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "G1 := plot3d(f,-3..3,-3..3,axes=normal):\nG2 := plot3d(p,-3..3,- 3..3,color=blue):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "displa y(G1,G2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 13 "Contour Plots" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 266 "Level curves can be generated with the contourplot comma nd, which is also part of the plots package. We need to communicate t he function and the region in which we want to see the level curves. \+ To view the level curves of our function for -4 < x , y < 4, we enter " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "contourplot(f,-4..4,-4..4);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 76 "The same plot with colors (contou rs = 8 controls the number of level curves)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "contourplot(f,-4..4,-4..4,contours=8,coloring=[red,bl ue],filled=true);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 91 "We can also \+ control the values in f(x,y) = k by setting specific values of k. For example:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "contourplot(f,-4..4,-4 ..4,contours=[-1.5,-1,-0.5,0,1]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "Implicit Pl ots" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "Let's now turn to functions of three variables, and use " }{XPPEDIT 18 0 "g(x,y,z) = x^2+4*y^2-z^ 2;" "6#/-%\"gG6%%\"xG%\"yG%\"zG,(*$F'\"\"#\"\"\"*&\"\"%F-*$F(F,F-F-*$F )F,!\"\"" }{TEXT -1 60 " as an example. First we define g in the fu nction syntax." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "g := x -> x^2+4*y ^2-z^2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 206 "Level surface require to use three dimensional implicit plots. We need to communicate the \+ equation which is to be plotted and the ranges for the variables. For example, the level surface for g = 0 becomes" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "implicitplot3d( g(x,y,z)=0, x=-5..5,y=-5..5, z=-5..5, axes=normal);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "By adding more p oints, the surface looks a little bit nicer at the origin." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "implicitplot3d( g(x,y,z)=0, x=-5..5,y=-5..5 , z=-5..5,axes=normal,numpoints=50000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 262 "Here we display three level surfaces simultaneously. The figure shows the transition from a hyperboloid of two sheets into a h yperboloid of one sheet by way of a cone. It is sliced open, and you \+ need to move the figure around to get a good view of the surfaces." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 167 "implicitplot3d( [g(x,y,z)=0, g(x,y ,z)=1, g(x,y,z)=-1], x=0..2,y=-2..2, z=-2..2,axes=normal,numpoints=500 00,style=wireframe,color=[red,blue,green],scaling=constrained);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 31 "Same thing, but with animation." } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 100 "animate( implicitplot3d, [g(x,y,z ) = c, x=-2..2,y=-2..2,z=-2..2,numpoints=5000],c=-1..1, frames=51);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "Partial \+ Derivatives" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "We have not restart ed, and the definitions of f and g are still active." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "f(x,y);\ng(x,y,z);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 295 "In taking partial derivatives we have the same distincti on between D and diff, as we had for functions of one variable. D app lies to functions, diff applies to expressions! We illustrate this by showing the two options side by side. The partial derivative of f wi th respect to x is found by " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "D[ 1](f)(x,y);\ndiff(f(x,y),x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 82 "O f course the results are identical. The partial with respect to y is \+ found from " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "D[2](f)(x,y);\ndiff( f(x,y),y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 50 "For higher order de rivatives we process as follows" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 33 " D[1,1](f)(x,y);\ndiff(f(x,y),x,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "Here is the mixed partial derivative " }{XPPEDIT 18 0 "f[xxxy] (x,y);" "6#-&%\"fG6#%%xxxyG6$%\"xG%\"yG" }{TEXT -1 12 " both ways" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "D[1,1,1,2](f)(x,y);\ndiff(f(x,y),x ,x,x,y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 76 "Evaluation of a parti al derivative is straightforward in the function syntax" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 13 "D[1](f)(3,2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 113 "With diff this is a little bit more tedious. We need tw o steps: first differentiate, then substitute the values:" }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 35 "diff(f(x,y),x);\nsubs(\{x=3, y=2\},%);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 121 "One advantage of diff is that you don't need to define the function in advance. You can just enter the expression as is:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "diff( x^2 - 2 *x*y + exp(x*y) , x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" } }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 24 "Implicit Differentiation" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 156 "Implicit differentiation is also \+ possible. We need to specify the equation, the dependent and the inde pendent variable (in that order). Here is an example" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "SFC := z^2 = x^2 - 4*y^2 +4*x*y*z;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "In case you wonder about the shape of thi s surface:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "implicitplot3d(SFC,x= -4..4,y=-4..4,z=-4..4,axes=normal, numpoints=5000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "The partial of z with respect to x is" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "implicitdiff(SFC,z,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "Differentiation of z withrespect to y yields" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "implicitdiff(SFC,z,y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "Double check the long way. First solve t he equation SFC for z" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "solve( SFC ,z);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "Take the first answer and call this function h(x,y)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "h := \+ (x,y) -> 2*x*y+(4*x^2*y^2+x^2-4*y^2)^(1/2);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 63 "Now take the derivateive of h with respect to x and ca ll it HX" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "HX := diff(h(x,y),x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "The result from implicit differ entiation was (call it ZX)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "ZX := implicitdiff(SFC,z,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 27 "Now su bstitute h(x,y) for z" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "subs( z = \+ h(x,y), ZX);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 19 "Is this equal to \+ HX" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 19 "Does this equal HX?" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "% - HX;" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 12 "simplify(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 6 "BINGO!" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "0 0 0" 43 } {VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }