{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 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{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" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 2" -1 4 1 {CSTYLE "" -1 -1 "Times" 1 14 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 2 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 257 1 {CSTYLE "" -1 -1 "T imes" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 } } {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 42 "Three Dimensional Graphi ng\nAn Introduction" }}{PARA 257 "" 0 "" {TEXT -1 21 "Math 252, Spring 2005" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "# last update 1/24 /2005" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 20 "Plotting with plot3d" } }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 163 "As always, we can use the function or the expres sion approach to obtain a three dimensional graph of a function. Let' s illustrate both methods for the paraboloid " }{XPPEDIT 18 0 "z = x^2 +y^2;" "6#/%\"zG,&*$%\"xG\"\"#\"\"\"*$%\"yGF(F)" }{TEXT -1 23 " or, in function form " }{XPPEDIT 18 0 "f(x,y) = x^2+y^2;" "6#/-%\"fG6$%\"xG %\"yG,&*$F'\"\"#\"\"\"*$F(F+F," }{TEXT -1 21 " , and begin in the " } {TEXT 256 16 "function setting" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "f := (x,y) -> x^2+y^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "plot3d(f,-3..3,-3..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "The same graph in the " }{TEXT 261 18 "expression setting" }{TEXT -1 15 " is obtained by" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "z := x^2+y^2 ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "plot3d(z,x=-3..3,y=-3. .3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 251 "Study the differences ca refully! In the function setting you indicate the range of the variab les, regardless of their names, in the expression setting you have to \+ specify that you mean x and y. In the sequel I will use either method . Here are some " }{TEXT 257 7 "options" }{TEXT -1 48 " you may use t o improve the looks of your graph:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "plot3d(f(x,y),x=-3.5..3.5,y=-3.5..3.5,axes=normal, v iew=[-3.5..3.5,-3.5..3.5 ,-1..10], title='Paraboloid');" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 244 "Other useful options include\nscaling = \+ constrained (for 1:1 appearence), style=patchcontour (to show curve of equal \"elevation\", numpoints = 1000 (or higher, to improve the reso lution of your graph), color = ...(set the color of your surface). " } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 4 "" 0 " " {TEXT -1 14 "Several Graphs" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 177 " Several surfaces can be displayed in a common graph with plot3d as we ll, just enclose the respective equations with brackets. Example (the definition of f is still in effect):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 103 "plot3d([f(x,y), 4 + x - y/2],x=-3.5..3.5, y=-3.5..3. 5, axes=normal, view=[-3.5..3.5,-3.5..3.5,-1..10]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 224 "A second method to show several surfaces in a \+ common graph is to apply the display command. Save each graph as G1, \+ G2, etc. and then generate the combinded graph by display(G1,G2,G3). \+ A \"with(plots)\" is required. Example:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 214 "with(plots):\nPara := plot3d( f(x,y),x=-3.5..3.5,y=- 3.5..3.5,axes=normal, view=[-3.5..3.5,-3.5..3.5 ,-1..10], title='Parab oloid'):\nplane := plot3d( 4+x-y/2, x=-3.5..3.5,y=-3.5..3.5, color=blu e):\ndisplay(Para,plane);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 9 "Countours" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "Curves of equal function values can be displaye d with the style=patchcontopur option. Example:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "f := (x,y) -> (x+y)/(x^2+y^2+1);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 57 "plot3d(f,-10..10,-10..10,style=patchcontour, axes=normal);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 460 "Be encopuraged \+ to twist and turn the surface so that the xy-plane is horizontal and t he z-axis is vertical. On my version of maple the different levels of function values appear in increments of 0.1 in the z-directiopn. If \+ you turn the graph such that you view the surface from above, you will see a family of circles in the xy-plane. These are the level curves. Level curves can be obtained directly with the contourplot command ( \"with(plots):\" required)." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with (plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "contourplot(f,- 10..10,-10..10);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Some options \+ for contourplot are included below." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 91 "contourplot(f,-10..10,-10..10,contours=12,coloring=[blue,red], fil led=true,numpoints=1000);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 37 "Cylindrical and Spherical Coordinates" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "resta rt;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 15 "The syntax for " }{TEXT 258 22 "cylindrical coordinate" }{TEXT -1 191 " plots is plot3d( r , theta range, z range, .... coords = cylindrical). Note that coords= cylindrical is used as a plotting option. Conversion to cylindrical c oordinates for our example " }{XPPEDIT 18 0 "z = x^2+y^2;" "6#/%\"zG, &*$%\"xG\"\"#\"\"\"*$%\"yGF(F)" }{TEXT -1 10 " yields " }{XPPEDIT 18 0 "z = r^2;" "6#/%\"zG*$%\"rG\"\"#" }{TEXT -1 39 " . The plot is a ccomplished as follows" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "p lot3d(sqrt(z),t = 0..2*Pi,z=-1..10,coords=cylindrical,axes=normal); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 129 "For spherical coordinates the \+ syntax is plot3d( rho , theta range, phi range, .. coords=spherical . .). In our example we have " }{XPPEDIT 18 0 "rho = cos(phi)/(sin(phi )^2);" "6#/%$rhoG*&-%$cosG6#%$phiG\"\"\"*$-%$sinG6#F)\"\"#!\"\"" } {TEXT -1 24 " and the graph becomes " }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 71 "R := cos(s)/(sin(s)^2);\nplot3d(R,t =0..2*Pi,s=0..Pi/2,coords=spherical);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "In the example the angle " }{XPPEDIT 18 0 "theta;" "6#%&t hetaG" }{TEXT -1 134 " never occurred explicitly due to the rotationa l symmetry. Plots in spherical or cylindrical coordinates can also be obtained using " }{TEXT 259 10 "sphereplot" }{TEXT -1 4 " or " } {TEXT 260 12 "cylinderplot" }{TEXT -1 53 ". There require a \"with(pl ots)\". An example follows." }{MPLTEXT 1 0 1 " " }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 60 "with(plots):\nsphereplot( 1.2^t*sin(s), t=-Pi. .2*Pi,s=0..Pi);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "Implicit Plots" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 342 "Suppose that a \+ surface is given by an equation and that it is difficult or impossible to solve the equation for z explicitly. In this case the can attempt to use the implicitplot3d command. Implicitplot will require ranges for x, y and z, and it will attempt to mark all points within that cu be, which satisfy the given equation. Example:" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 21 "restart; with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "S := z^2 = x^2 - 2*x + 4*y^2 + 2;\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 138 "Solving the equation above for z would r equire + or - a square root, therefore we prefer to proceed with plott ing the equation implicitly." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 96 "imp licitplot3d(S,x=-2..4,y=-2..2,z = -3..3, numpoints=5000, \naxes=normal , scaling=constrained); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 17 "Curves in 3-space" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 208 "The met hod to plot curves in space is straightforward, use the spacecurve com mand, provide formulas for x,y,and z, and give a range for the paramet er.. We proceed with an example: Graph the curve given by " } {XPPEDIT 18 0 "x = (cos*t)^2;" "6#/%\"xG*$*&%$cosG\"\"\"%\"tGF(\"\"#" }{TEXT -1 3 " , " }{XPPEDIT 18 0 "y = (sin*t)^2;" "6#/%\"yG*$*&%$sinG \"\"\"%\"tGF(\"\"#" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "z = sin(8*t); " "6#/%\"zG-%$sinG6#*&\"\")\"\"\"%\"tGF*" }{TEXT -1 23 " for t betwe en 0 and " }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "restart; with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 114 "spacecurve([cos(t)^2, sin(t)^2, si n(8*t)], t=0..Pi, numpoints=200, thickness=2, axes=normal, scaling=con strained);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 76 "Another example: A line segment which connects two given points on a graph." }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 277 "f := (x,y) -> x*y;\na := 1; b := 2; c := -1 ; d := 2;\nP := [a, b, f(a,b)]; \nQ := [c ,d, f(c,d)];\nv := Q-P;\nX \+ := P[1] + t*v[1];\nY := P[2] + t*v[2];\nZ := P[3] + t*v[3];\nL := spac ecurve([X,Y,Z],t=0..1,thickness=3, color=blue, axes=normal):\nS := plo t3d(f,-2..2,-1..3):\ndisplay(S,L);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}} {MARK "2" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }