\(MATH\ 257\ Calculus\ III				Week\ of\ May\ 19, \ 2003\)
Lab 8 :  Surfing Surfaces
Name 1
Name 2
Section:

Make sure you execute all the commands in this lab as you read through it.  Do this, or you will perish...

Graphing 3D Surfaces

Graphing 3D surfaces in Mathematica is easy if you have a function of the form z=f(x,y).  Just use the Plot3D[] command, which works just like Plot[] except you have to specify the x and y ranges.

For example, let's plot  f[x,y]=Cos[x*y] - Sin[x*y]:

Plot3D[
      Cos[x*y] - Sin[x*y],  {x,  -4, 4},  {y, -4, 
        4}]

Cool, but notice how chunky the graph is.  To make it finer, use the PlotPoints option:

Plot3D[Cos[x*y] - Sin[x*y],  {x,  -4, 4},  {y, -4, 4},  
      PlotPoints -> 40]

We can also make traces, that is, slices through the x or y axes.  The easiest way to do this is using the Table[] command.  Here we make traces where we fix x=k for some constant k:

Clear[f, x, y];
f[x_, y_] :=  
                Cos[x*y] - Sin[x*y];
xtraces = 
              Table[f[k, y],  {k, 0, 2}];     
Plot[
          Evaluate[xtraces],  {y,  -3, 3}]

Question 1: In the above trace graph, which curve corresponds to the trace x=0, x=1, and x=2?  You can answer this in a few sentances or make additional pictures to give your answer.

We can also do the y-traces.  Notice that for this surface that are notably similar to the x-traces.

ytraces = 
        Table[f[x, k],  {k, 0, 3}];  

    Plot[Evaluate[ytraces],  {x,  -3, 3}]

To do the z-traces (slices through the z-axis, parallel to the xy-plane), we need to use the ContourPlot[] command.  If you don't like the resolution, use the PlotPoints option again.

ztrace = 
      ContourPlot[f[x, y],  {x, -3, 3},  {y, -3, 3}]

If you don't like the shading, you can get rid of it.

ztrace = 
      ContourPlot[f[x, y],  {x, -3, 3},  {y, -3, 3},  
        PlotPoints -> 40,  ContourShading -> False]

Question 2: Notice how in the above contour plot the trace curves look like ... what?  Hyperbolas?  Get an equation for one of them using the Solve[] command to solve f[x,y] = z when z=1.  (Solve for either y or x.)  Make a plot of the equation you get to see that it looks like one of the contours above.

Question 3: For the following functions, make (i) a 3D plot, (ii) x- and y-traces, and (iii) a contour plot (z-trace). Be sure to LABEL your images so we can tell what they are!
	(a)   z = Sin[x+y] + Cos[x-y]	
	 (b)  z = 20 (e^(-(((x^2)  +  (y^2))/3)))   (make sure you get the whole thing!)

Spherical Surfaces

Graphing surfaces made by equations in spherical coordinates takes a little bit of prep-work.  Mathematica doesn't just do it all for you.  It helps a lot if we define a function to convert from spherical to rectangular coordinates.  DO THIS COMMAND:

sphrToRect[{ρ_,  θ_,  ϕ_}] = {ρ*Sin[ϕ]*Cos[θ],  ρ*Sin[ϕ] 
          Sin[θ],  ρ*Cos[ϕ]}

This takes a point in spherical coordinates (ρ, θ, ϕ) and converts it to regular (x, y, z), like God intended!
Test it out:

sphrToRect[{1,  π/6,  π/
          3}]

We can use this command to graph equations in spherical coordinates.  

Example:  Suppose we wanted to graph the equation ρ = 3, which should be a sphere of radius 1.  Just set ρ = 3 and let θ and ϕ range over some values:  0 ≤ θ ≤ 2π  and   0 ≤ ϕ ≤ π:  We need to use the ParametricPlot3D command to do this, however:

ParametricPlot3D[
      sphrToRect[{3, θ, ϕ}],  {θ,  0,  
        2  π},  {ϕ,  0,  π}]

But what happens if we change the range of, say, θ?  Let's find out:

ParametricPlot3D[
      sphrToRect[{3, θ, ϕ}],  {θ,  0,  
        7  π/4},  {ϕ,  0,  π}]

Question 4a: Make a good picture that shows what the spherical equation  ρ = 2 θ   looks like.  Tip: you have to make θ range to some higher values, like 0 ≤ θ ≤ 10 or something.  Also, you won't be able to see all the cool stuff going on inside unless you change the range of ϕ as well.  (Like,  1 ≤ ϕ ≤ π  or something like that.)  Make sure your picture displays this.  Then describe what this surface is like in a sentance or two.

Question 4b:  Do the same thing for ρ = 1 + Sin[ϕ].   (Make a picture that shows what this surface does, and describe it in words as well.) Make sure to try some negative values of ϕ and see what's going on inside.

Now that you're done, 
	(1) 	Clean up your work by deleting everything that's not needed.  
		There should only be the title, your names, section number, and the questions and your answers
		(with any needed explanations, graphs, etc.).
	(2) 	Save this to your disk.
	(3)	Go back to Blackboard and upload your final lab report to the Digital Drop Box, located
		in the User Tools area.  Remember that you have to first ADD your file to your digital drop box and 
		then SEND it to me!
		
Note:  these graphic images can get BIG.  Make sure you DELETE any images that you do not need for your answers.  This will reduce the chances of something going wrong when you upload it to Blackboard.