Lab 2B - Parametrizing Surfaces
Math 2374 - University of Minnesota
http://www.math.umn.edu/math2374
Questions to: rogness@math.umn.edu

Introduction

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.

[Graphics:HTMLFiles/index_1.gif]

A First Look

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

In[41]:=

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

Out[41]=

x^2 + y^2

[Graphics:HTMLFiles/index_4.gif]

Out[42]=

⁃SurfaceGraphics⁃

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:

In[43]:=

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

[Graphics:HTMLFiles/index_9.gif]

Out[43]=

⁃SurfaceGraphics⁃

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):

In[44]:=

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

Out[44]=

{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:

In[45]:=

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

[Graphics:HTMLFiles/index_18.gif]

Out[45]=

⁃Graphics3D⁃

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,

In[46]:=

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

Out[46]=

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

[Graphics:HTMLFiles/index_23.gif]

Out[47]=

⁃Graphics3D⁃

Or, with other values of h:

In[48]:=

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}]

[Graphics:HTMLFiles/index_26.gif]

Out[48]=

⁃Graphics3D⁃

[Graphics:HTMLFiles/index_28.gif]

Out[49]=

⁃Graphics3D⁃

Or, all together:

In[50]:=

Show[disk0, disk1, disk2]

[Graphics:HTMLFiles/index_31.gif]

Out[50]=

⁃Graphics3D⁃

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:

In[51]:=

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

Out[51]=

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

[Graphics:HTMLFiles/index_35.gif]

Out[52]=

⁃Graphics3D⁃

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

In[53]:=

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

[Graphics:HTMLFiles/index_38.gif]

Out[53]=

⁃Graphics3D⁃

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:

In[54]:=

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

[Graphics:HTMLFiles/index_41.gif]

Out[54]=

⁃Graphics3D⁃

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

In[55]:=

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

Out[55]=

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

[Graphics:HTMLFiles/index_45.gif]

Out[56]=

⁃Graphics3D⁃

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):

In[57]:=

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}]

Out[57]=

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

[Graphics:HTMLFiles/index_50.gif]

Out[58]=

⁃Graphics3D⁃

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

In[62]:=

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"}]

Out[62]=

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

[Graphics:HTMLFiles/index_54.gif]

Out[63]=

⁃Graphics3D⁃

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

In[64]:=

ShowLive[%]

Out[64]=

⁃Graphics3D⁃

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:

In[65]:=

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…

Out[65]=

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

In[66]:=

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…

Out[66]=

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:

In[67]:=

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

Out[67]=

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

[Graphics:HTMLFiles/index_75.gif]

Out[68]=

⁃Graphics3D⁃

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.

In[69]:=

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

[Graphics:HTMLFiles/index_88.gif]

Out[69]=

⁃Graphics3D⁃

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:

In[70]:=

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

Out[70]=

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

[Graphics:HTMLFiles/index_94.gif]

Out[71]=

⁃Graphics3D⁃

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...)

In[72]:=

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}]

Out[72]=

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

[Graphics:HTMLFiles/index_98.gif]

Out[73]=

⁃Graphics3D⁃

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

In[74]:=

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}]

Out[74]=

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

[Graphics:HTMLFiles/index_102.gif]

Out[75]=

⁃Graphics3D⁃

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:

[Graphics:HTMLFiles/index_114.gif]

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:

[Graphics:HTMLFiles/index_116.gif]

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

Credits


Created by Mathematica  (November 6, 2004)