Lab 2B - Parametrizing Surfaces
Math 2374 - University of Minnesota
Questions to:


As in last week's lab, there is no calculus in this notebook.  Last week you learned how to graph curves using ParametricPlot and ParametricPlot3D.  You also had the chance to find the parametrizations for various curves.  This week we'll do the same thing with surfaces.

We haven't rigorously defined surfaces yet, but you probably have an intuitive idea of what a surface is.  It's like a piece of paper, or a sheet of rubber, but it doesn't have to be flat; it can be bent, curved, or even have holes in it.  Sometimes a surface encloses a solid region in space.  If so, we call it a closed surface.  The following pictures both show surfaces; the last one is a closed surface, while the first is not.


A First Look

Often our surfaces will be (a piece of) the graph of a function z=f(x,y), such as this example:


f[x_, y_] = x^2 + y^2 Plot3D[f[x, y], {x, -1, 1}, {y, -1, 1}]


x^2 + y^2




Mathematica can draw a great picture of graphs like this, but Plot3D has its limitations.  For example, what if we wanted to plot the graph of x = y^2 + z^2 ?  You should know by looking at this equation that this is a paraboloid, just like our picture above, except this one opens in the direction of the positive x-axis.  Suppose we tried to plot this with Plot3D:


Plot3D[y^2 + z^2, {y, -1, 1}, {z, -1, 1}]




We get exactly the same picture as before!  The paraboloid opens upwards, which is incorrect.  The reason is that Plot3D expects a function of two variables, and it interprets the values of the function as the height.  Normally we give it a function of x and y, and since the z-axis represents height, this fits in to our view of the world.  

How can we get a true graph of x = y^2 + z^2 from Mathematica? Using parametric equations is one possibility.  Think back to last week when we did a "trivial parametrization" of the graph of y=g(x) by setting f(x) equal to (x, g(x)).  Define f(y,z)=(y^2 + z^2, y, z):


f[y_, z_] = {y^2 + z^2, y, z}


{y^2 + z^2, y, z}

Essentially we're saying that y and z are our parameters.  Now we can plot the graph of f using ParametricPlot3D:


ParametricPlot3D[f[y, z], {y, -1, 1}, {z, -1, 1}, AxesLabel {"x", "y", "z"}]




And you can see that this is a paraboloid opening in the direction of the positive x-axis, as desired.

Note that we're using two parameters now, which is different than when we plotted curves.  This makes sense, if you think about it.  Curves are like a line, a one-dimensional object, so they require one parameter.  Surfaces are two-dimensional creatures, and so they require two parameters.

Note: if a curve is in the xy-plane, you can use ParametricPlot, or you can use ParametricPlot3D by letting z(t)=0.  If you want to plot a surface, however, you must use ParametricPlot3D.  The command ParametricPlot will not accept more than one parameter!  (So you can't give it ranges for, say, y and z.)

Also, most of this lab uses ParametricPlot3D, so if you're using Mathematica version 4.x it would be a good idea to execute the command Off[ParametricPlot3D::ppcom] to get rid of those blue error messages about compiling functions.  People using Mathematica 5.0 needn't worry about this.

More Examples

Let's look at more examples of how to parametrize surfaces.  As in last week's lab, circular regions will be very important, and there is one technique in particular that you should learn.  Many of our surfaces will be relatively easy to describe using cylindrical coordinates (r,θ,z), which have been covered in class.  A parametrization has to be in rectangular coordinates (x,y,z), so we can't just describe the surface in cylindrical coordinates and say we're done.  But if we've described the surface in cylindrical coordinates, we can use the following formulas to convert our description into rectangular coordinates:

x = r Cos[θ]
y = r Sin[θ]
z = z

Example 1(a).  Disks of Radius R in the Plane z=h

In cylindrical coordinates, such a disk is described by (r,θ,h) where 0≤r≤ R, 0≤θ≤2π, and h is some constant number.  Converting to rectangular coordinates, we have: f(r, θ) = (r Cos[θ], r Sin[θ], h), where r and θ have the same bounds.  (r and θ are our parameters now.)  For example, if R=1 and h=0,


f[r_, theta_] = {r * Cos[theta], r * Sin[theta], 0} disk0 = ParametricPlot3D[f[r, theta], {r, 0, 1}, {theta, 0, 2Pi}]


{r Cos[theta], r Sin[theta], 0}




Or, with other values of h:


disk1 = ParametricPlot3D[{r * Cos[theta], r * Sin[theta], 1}, {r, 0, 1}, {theta, 0, 2Pi}] disk2 = ParametricPlot3D[{r * Cos[theta], r * Sin[theta], 2}, {r, 0, 1}, {theta, 0, 2Pi}]







Or, all together:


Show[disk0, disk1, disk2]




FYI: Normally when we use one parameter we choose the letter t.  When we use two parameters, the standard letters are s and t.  So often we would write these parametrizations as (for example):

f(s,t) = (s·Cos[t], s·Sin[t], 0),        0≤s≤1, 0≤t≤2π.

When we do a parametrization related to cylindrical coordinates, it might be more intuitive to use r (=radius) and t (=theta), but you're not required to do so.  You should also be aware that some textbooks use u and v as parameters instead of s and t (or r and t).

Example 1(b).  An Annulus

We won't actually use this much, but it's an interesting example to point out.  Suppose we parametrize the disk of radius 4 in the plane z=1:


f[s_, t_] = {s * Cos[t], s * Sin[t], 1} ParametricPlot3D[f[s, t], {s, 0, 4}, {t, 0, 2Pi}]


{s Cos[t], s Sin[t], 1}




Now, instead of letting s range from 0 to 4, let's use values of s from 2 to 4 instead:


ParametricPlot3D[f[s, t], {s, 2, 4}, {t, 0, 2Pi}]




This type of surface is called an annulus.  More informally, we might refer to this surface as a "washer," as in the little thing you can buy at the local hardware store.

Example 2.  A Filled in Ellipse.

Last week we parametrized an ellipse:


ParametricPlot3D[{4Cos[t], 3Sin[t], 0}, {t, 0, 2Pi}]




We can fill in the ellipse by introducing a second parameter, s.  Notice the similarity to the disk above!


f[s_, t_] = {4s * Cos[t], 3s * Sin[t], 0} ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 2Pi}]


{4 s Cos[t], 3 s Sin[t], 0}




Example 3.  Shifted Circles and Ellipses.

As with our circles last week, we can shift a circle so that it's centered at another point by adding the appropriate numbers to the components of the parametrization.  For example, here's a disk of radius 2 in the plane z = 3 centered at (1.5,1):


RowBox[{f[s_, t_], =, RowBox[{{, RowBox[{RowBox[{1.5,  , +,  , s * Cos[t]}], ,, 1 +   s * Sin[t], ,,  , 3}], }}]}] ParametricPlot3D[f[s, t], {s, 0, 2}, {t, 0, 2Pi}]


RowBox[{{, RowBox[{RowBox[{RowBox[{1.5, }], +, s Cos[t]}], ,, 1 + s Sin[t], ,, 3}], }}]




It's also easy to graph a circle or ellipse in, say, the yz-plane instead of the xy-plane:


f[s_, t_] = {0, 4 + 4s * Cos[t], 2 + 2s * Sin[t]} ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 2Pi}, AxesLabel {"x", "y", "z"}]


{0, 4 + 4 s Cos[t], 2 + 2 s Sin[t]}




Use the following command to rotate the previous picture and see which plane the ellipse is in.





Example 4.  A Piece of a Paraboloid

Suppose we want to work with the portion of the paraboloid z=x^2+y^2 which is above the unit disk in the xy-plane.  We could try the "trivial" parametrization,

f(x,y) = (x, y, x^2+y^2),         where -1≤x≤1 and -(1 - x^2)^(1/2) ≤ y ≤ (1 - x^2)^(1/2)

The problem is that neither Plot3D or ParametricPlot3D accept bounds like that for y.  Try it!  Both of these commands will produce errors:


Plot3D[x^2 + y^2, {x, -1, 1}, {y, -Sqrt[1 - x^2], Sqrt[1 - x^2]}]

                                            2                    2             2 Plot3D :: pll ...   -Sqrt[1 - x ] in {y, -Sqrt[1 - x ], Sqrt[1 - x ]} is not a machine-size real number. More…


Plot3D[x^2 + y^2, {x, -1, 1}, {y, -(1 - x^2)^(1/2), (1 - x^2)^(1/2)}]


ParametricPlot3D[{x, y, x^2 + y^2}, {x, -1, 1}, {y, -Sqrt[1 - x^2], Sqrt[1 - x^2]}]

                                                      2                    2             2 Par ...   -Sqrt[1 - x ] in {y, -Sqrt[1 - x ], Sqrt[1 - x ]} is not a machine-size real number. More…


ParametricPlot3D[{x, y, x^2 + y^2}, {x, -1, 1}, {y, -(1 - x^2)^(1/2), (1 - x^2)^(1/2)}]

We can solve this problem, though.  It turns out to be very easy to parametrize the surface if we describe it in cylindrical coordinates first.  Our x and y values are in the unit disk; this corresponds to 0≤r≤1 and 0≤θ≤2π.  All we need to do is describe  z=x^2+y^2in terms of r and θ; but we know that x=rCos[θ] and y=rSin[θ]!  On paper, square these and add them together; you should get z = r^2 .  So our parametrization is:


f[r_, theta_] = {r Cos[theta], r Sin[theta], r^2} ParametricPlot3D[f[r, theta], {r, 0, 1}, {theta, 0, 2Pi}]


{r Cos[theta], r Sin[theta], r^2}




Scroll up and compare this graph to the very first graph in this lab, which is of the very same paraboloid.  Notice how much nicer it looks when we use a circular domain and ParametricPlot3D instead of Plot3D and the rectangle -1≤x≤1, -1≤y≤1.

FYI:  Sometimes this graph is called "the portion of the paraboloid z=x^2+y^2which is above the unit disk."  Even more commonly we might call it "the portion of the paraboloid z=x^2+y^2 cut off by the cylinder x^2+y^2= 1;" it's really the same thing if you think about it.  If we draw the cylinder x^2+y^2= 1 and only take the points of the paraboloid which are inside the cylinder, we get those points which, in cylindrical coordinates, have a radius between 0 and 1.  Those are precisely the points we used while creating this graph!

Example 5.  A Cylinder

So far nearly everything we've graphed has actually been a function of x and y -- for example, the circles were really just plots of z=0 (or z=1, z=2) where we happened to restrict our domain of x- and y- values to get a circle.  Here's an example which is not a function of x and y!  Let's graph the cylinder x^2+y^2=9, 0≤z≤10.  You learned in an earlier lab that you can graph this cylinder with the following command.  If you don't remember for sure how ContourPlot3D works, you should look back at Lab 1B.


ContourPlot3D[x^2 + y^2 - 9, {x, -6, 6}, {y, -6, 6}, {z, 0, 10}]




The problem with this approach is that we can see the cylinder, but we can't really work with it because we don't have a parametrization.  So let's find a way to plot it using ParametricPlot3D.

Because we're graphing a cylinder, it's very natural to describe it in cylindrical coordinates.  With our earlier disks and other surfaces, r and θ varied while z stayed constant (or at least depended on r and θ).  So r and θ were our two parameters.  Now our situation is a little different.  In the cylinder x^2+y^2=9, r is constantly equal to three, θ ranges from 0 to 2π, and z ranges from 0 to 5.  So now θ and z are our two parameters, and when we convert from cylindrical to rectangular coordinates we get:


f[theta_, z_] = {3Cos[theta], 3Sin[theta], z} ParametricPlot3D[f[theta, z], {theta, 0, 2Pi}, {z, 0, 10}]


{3 Cos[theta], 3 Sin[theta], z}




Compare this to the plot from ContourPlot3D and decide which one you think looks better!

Example 6.  A Helicoid.

Here's another example which is not a function of x and y.  Using the same sort of technique as with the circle and the ellipse -- multiplying x(t) and y(t) by a new parameter that ranges from 0 to 1 -- we can "fill in" the helix from last week's lab, producing sort of a spiral staircase.  (Well, at least a spiral ramp, anyway...)


f[s_, t_] = {s * Cos[2Pi t], s * Sin[2Pi t], t} ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 4}, PlotPoints {15, 30}]


{s Cos[2 π t], s Sin[2 π t], t}




This is somewhat choppy, but if we use the PlotPoints option with ParametricPlot3D, we can make it look better:


f[s_, t_] = {s Cos[2Pi t], s Sin[2Pi t], t} ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 4}, PlotPoints {15, 80}]


{s Cos[2 π t], s Sin[2 π t], t}




A filled-in helix such as this is called a helicoid.

FYI: Note that the PlotPoints option is used a little differently if we're plotting surfaces instead of curves.  Last week you learned that with just one parameter, PlotPoints tells ParametricPlot3D how many different values of that one parameter to use.  When you have two parameters, however, you must tell ParametricPlot3D how many different values of each parameter to use.  That's why in the command above, we used a list of numbers after PlotPoints instead of just one number.  In the command above we told ParametricPlot3D to use 15 different values for s, and 50 different values for t.  Because Mathematica plots a point of the surface for every possible combination of s and t, that means we drew the nicer looking helix with 15*80=1200 points, instead of 15*15=225 points with the default values.  No wonder it looks better!

Warning!  With just one parameter, the default PlotPoints value is 75, and we often increased it to 400.  With surfaces -- i.e. if you give ParametricPlot3D two parameters -- the default value is {15, 15}.  (Sometimes Mathematica changes its defaults to make things look better, but it doesn't always do a good job.)  If you try to increase these numbers as high you can with one parameter, you will run out of memory and Mathematica will crash, and you will lose your work.  As a rule of thumb, when plotting surfaces you should never use values {a, b} with PlotPoints if a*b is bigger than, say, 1500 or so.

And now for something completely different...

Exercise 1

Graph the portion of the paraboloid x = y^2 + z^2 which is cut off by the cylinder y^2 + z^2= 1.

Hint: use the ideas of Example 4.  In fact, you can start with the same parametrization, and then flip-flop some of the components to get the right answer!

You should hand in your parametrization (including the bounds for your parameters!), a picture of the graph, and an explanation of how you arrived at your parametrization.  Stumbling across the correct graph without understanding why it works will result in very little credit.

Exercise 2

In Example 5 we graphed the cylinder  x^2+y^2=9.  Now graph the hyperbolic paraboloid z = (x^2 - y^2)/10+ 3.  (Suggestion: use Plot3D with x- and y-ranges of {x,-4,4} and {y,-4,4}.)  Show the two of these graphs together so you can see what the intersection looks like.

(a)  The intersection of the cylinder and the hyperboloid is a curve.  Find a parametrization for this curve.  (Your answer should NOT be the parametrization of a surface!)  

Hint: you did a problem similar to this in Exercise 3 in last week's lab.  Now that you've used cylindrical coordinates, here's an easy way to find the parametrization if you were confused by that problem: you can actually describe this curve in cylindrical coordinates. r will be constant, θ will change, and z will depend on θ, so θ is your parameter.  Now express z in terms of θ (and the constant r) and change back to rectangular coordinates.

(b)  Find a parametrization for the portion of the hyperboloid which is cut off by the cylinder.  In other words, fill in the part of the surface which is inside the curve you found in part (a).   (Suggestion: when you graph the surface, use the option BoxRatios→{1,1,1} in ParametricPlot3D.)

You should hand in your parametrizations, complete with bounds for your parameters, and well as pictures of their graphs and an explanation of how you arrived at your answers.

Exercise 3

Throughout this lab we have described many surfaces using cylindrical coordinates, and then converted back to rectangular coordinates to get a parametrization.  Use this same idea to produce a graph of the unit sphere, x^2 + y^2 + z^2 = 1, using ParametricPlot3D.

Hint: describe the sphere in spherical coordinates, and then convert this description to rectangular coordinates using the given change-of-coordinate formulas in your book.

You should hand in your parametrization and an explanation of what you did to find it.

Exercise 4

Find a parametrization for the following surface:


Hint: the bottom of the ribbon is in the xy-plane and follows the graph of y = -Sin[x] .  The height of the ribbon is 1.

You should hand in your parametrization (as always, with bounds), a picture, and an explanation of how you arrived at your answer.

Exercise 5

Do Exercise 4 for the following surface:


Hint: the surface is a piece of the graph of x = -Cos(y * z).


Created by Mathematica  (November 6, 2004)