<< RealTime3D`

<< Graphics`

Calculus III - Lab 2b: 
3-Dimensional Graphs - Surfaces

Warning: Save early and save often when you are working on this lab.  Some of the computations are fairly memory intensive and you really don't want to suddenly have your computer lock up on you and lose an hour's work you never got around to saving.  You have been warned.

Surfaces

Functions

How does the shape of z = (x^2) + a (y^2) + x y depend on the value of a?  Clearly state your conclusion and illustrate it with an animation.

Cylindrical and Spherical coordinates

Mathematica has commands built in for graphing functions in cylindrical and spherical coordinates:  CylindricalPlot3D and SphericalPlot3D (see my introductory handout for usage; these are hard to find in the online help: go to the "Add-ons" button, then choose "Graphics", then "ParametricPlot3D").  These will plot z as a function of r and θ, and ρ as a function of θ and ϕ, respectively.  

The problem comes when you need to graph something like θ == (π/3)or ϕ == (π/6), neither of which are functions of z or ρ.  One possible solution to this is to make the following definitions:

cylindricalToRect[r_, θ_, z_] := {r Cos[θ], 
        r Sin[θ], z}

sphericalToRect[ρ_, θ_, ϕ_] := {ρ Cos[θ] 
          Sin[ϕ], ρ Sin[θ] 
          Sin[ϕ], ρ Cos[ϕ]}

In order to use these to graph something, you must be able to eliminate one of the domain variables.  Then use ParametricPlot3D to graph.  So, for example, to graph the two equations mentioned above, you could execute (the Evaluate command isn't crucial; it just stops Mathematica from giving you a warning every time):

ParametricPlot3D[
      Evaluate[cylindricalToRect[r, (π/3), z]], {r, -5, 
        5}, {z, -5, 5}]

ParametricPlot3D[
      Evaluate[sphericalToRect[ρ, θ, (π/6)]], {ρ, 0, 
        5}, {θ, 0, 2  π}]

Notice that SphericalPlot3D[
        f[θ, ϕ],  ... ] is the same as ParametricPlot3D[
        sphericalToRect[f[θ, ϕ], θ, ϕ],  ... ] (and cimilarly for CylindricalPlot3D).  This method allows you to graph a wide variety of graphs in spherical and cylindrical coordinates.

How does the shape of the surface r = sin(n θ) cos(m z) depend on the parameters m and n?  Clearly state your conclusions, illustrating them with examples.

Hint:  This is in cylindrical coordinates, but you can't easily use CylindricalPlot3D to graph it (because r is a function of θ and z, rather than z being a function of θ and r).

How does the shape of the surface ρ = 
        1 + 0.2  sin(m θ) sin(n ϕ) depend on the parameters m and n?  Clearly state your conclusions, illustrating them with examples.

(You CAN use the SphericalPlot3D function here if you wish.  Be careful to specify ϕ first in your range.)  This particular graphs have been suggested as models for tumors (they are often called "bumpy spheres").

Limits

Taking a limit of a function of two variables can be very difficult.  Mathematica can take limits of a function of a single variable relatively easy:

Limit[Sin[(Sqrt[x])]/x, x -> 0]

However, it does not have a built-in command for finding the limit of a multi-variable function.  This is unforunate (though not really surprising, considering the complications that can arise in 3 dimensions).  

For limits of functions of two variables, it can often be useful to graph the function around the limit point first.  This can give you an idea of whether the limit exists or not.  If it looks like it doesn't exist, the graph may give you some good ideas of what paths to test the limit along to look for differing values.  If you can find two different paths with two different limits, then you're done (the limit does not exist).  Mathematica can also aid you in taking limits along these paths.  If it looks like the limit does exist, you might be able to use Mathematica to ease your suffering as you try to prove it really does exist (sadly, Mathematica won't prove it for you...).

As an example, let's examine \(TraditionalForm\`\(\(Limit\)\(\ \)\)\+\(\((x, y)\) -> \((0, 0)\)\)\ \(x\^3 + \ y\^2\)\/\(x\^2 + y\^2\)\):

Plot3D[(((x^3)  + (y^2))/((x^2) + (y^2))), {x, -0.05, 
        0.05}, {y, -0.05, 0.05}, PlotPoints -> 40]

It can also be very useful to look at a contour plot over the same region:

ContourPlot[(((x^3)  + (y^2))/((x^2) + (y^2))), {x, -0.05, 
        0.05}, {y, -0.05, 0.05}, PlotPoints -> 100]

Althought you can't really tell for certain here, it looks like the graph may approach different limits, depending upon what path you approach it on.

Explain how the contour plot shows you the limit probably doesn't exist.

Now, let's test this on paths of the form y = m x:

Limit[(((x^3)  + (((m x))^2))/((x^2) + (((m x))^2))), 
      x -> 0]

Since this depends upon m, the limit cannot exist.  On the other hand, consider \(TraditionalForm\`lim\+\(\((x, y)\) -> \((0, 0)\)\)\(x\ y\^2\)\/\(x\^2 + y\^4\)\):

Plot3D[((x (y^2))/((x^2) + (y^4))), {x, -0.5, 0.5}, {y, -0.5, 
        0.5}, PlotPoints -> 100, Mesh -> False]

ContourPlot[((x (y^2))/((x^2) + (y^4))), {x, -0.2, 
        0.2}, {y, -0.2, 0.2}, PlotPoints -> 100]

The limit doesn't appear to exist here.  Again, let's check all linear paths through this point:

Limit[((x (((m x))^2))/((x^2) + (((m x))^4))), 
      x -> 0]

The contour lines here give you a clue:  they look (vaguely) parabolic.  So, let's try a parabolic path through the origin:

Limit[((x (((m (x^2)))^2))/((x^2) + (((m (x^2)))^4))), 
      x -> 0]

Of course, the contours actually look more like parabolas of the form x = m (y^2):

Limit[(((m (y^2)) (y^2))/((((m (y^2)))^2) + (y^4))), 
      x -> 0]

This goes to different limits for different values of m, so the original limit does not exist.  So, sometimes checking all lines isn't good enough.

Let's examine one more example:  \(TraditionalForm\`lim\+\(\((x, y)\) -> \((0, 0)\)\)\(x\^2 - y\^2\)\/\(x\^4 + y\^4\)\)

Plot3D[((x (y^3))/((x^2) + (y^2))), {x, -0.5, 0.5}, {y, -0.5, 
        0.5}, PlotPoints -> 60, Mesh -> False]

ContourPlot[((x (y^3))/((x^2) + (y^2))), {x, -0.5, 
        0.5}, {y, -0.5, 0.5}, PlotPoints -> 100]

Here, it looks like the limit DOES exist.  Notice that this doesn't actually prove this; you still have to figure out a way to do that.  Mathematica may or may not help to do this.  Hint:  for (x,y) close to (0,0), \(0 ≤ \(\(|\)\(y\^3\)\(|\)\)\/\(x\^2 + y\^2\) ≤  | 
        y | \)

For each of the following, use Mathematica to decide whether the limit exists or not.  Support your decision with appropriate graphs.  If it doesn't exist, confirm this fact algebraically.

1.  (lim_((x, y) -> (0, 0))) 
        Tan[(x^2) y]/Sin[Tan[(x^2) y]]

2.  \(TraditionalForm\`lim\+\(\((x, y)\) -> \((0, 0)\)\)\(ln(x\^2 + y\^4)\)\/\(sin(x\^6 + y\^2)\)\)

Note:  Mathematica uses the function Log for the natural logarithm (rather than ln).

3.  \(TraditionalForm\`lim\+\(\((x, y)\) -> \((0, 0)\)\)\(2  x - y\^2\)\/\(2  x\^2 + y\)\)

4.  \(TraditionalForm\`lim\+\(\((x, y)\) -> \((0, 0)\)\)\(Cos[2  x\ ] Sin[3  y]\)\/\(Sin[6  x] Cos[5  y]\)\)