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

Introduction

Other than a short bit about derivatives at the end of this notebook, Lab 2 is almost entirely devoid of calculus.  Instead, it's about visualizing and describing different curves and surfaces.  These skills will be very important later in this class,which is why we're spending so much time on them now.

This week we will consider parametric equations of curve.  The term "curve" has not been defined yet, but roughly speaking,a curve (or an "arc") is a curvy line in space.  If you like, you could think of a curve as a piece of string that's sitting in two- or three-dimensional space.

Examples are a segment of a straight line, a circle, or a section of any graph of a function .  Sometimes the curve will have two ends; sometimes the two ends of the curve will actually be the same point -- i.e.the two ends of the string are taped together.  In this case we call the curve a closed curve.  The following pictures are all examples of curves.  The middle picture is a closed curve; the others are not.

Curves in Two Dimensions

Why do we care about parametric equations?  There are many reasons, but one of the most important is that using parametric equations allows us to graph things that we otherwise wouldn't be able to graph.  For example,consider the unit circle +=1. You know from Lab 1A that one way to graph a function y=f(x) is the Mathematica command Plot.  To use this command we need to solve our equation for y, and this is where the trouble starts; we get two solutions, and .

We can plot these separately, but they each represent only half of the circle:

In[162]:=

Out[162]=

Out[163]=

(The AspectRatio→Automatic option forces Mathematica to scale the graph so it looks like a piece of a circle; try removing the option to see what happens.)

If we wish to see the whole circle, we can show the two graphs together:

In[164]:=

Out[164]=

So we do in fact get to see the whole circle, but we haven't really graphed the circle.  We've just pasted together two graphs to make it look like one circle.  Using parametric equations can solve this problem.  You've probably seen the parametric equations for the unit circle before:  , where 0≤t≤2π.  We can define these equations in Mathematica with the following commands:

In[165]:=

Out[167]=

(We don't actually have to define x and y separately;  we could the whole definition in one step by typing f[t_]={Cos[t],Sin[t]}.)

Once we have the parametric equation set up,we can graph it using the command ParametricPlot:

In[168]:=

Out[168]=

Now we have the same picture as above, but we produced it with one graphing command, instead of three!  Also -- and perhaps more importantly, in the long run -- we have a function of one variable which describes the entire circle, instead of the implicit function , which has two variables in it and is harder to work with.

We call f[t] a parametrization of the circle.  This is an important term, and you need to learn it.  Later this semester (and even later in this lab) we will ask you to "find a parametrization for..."  This means you need to find a parametric equation whose graph matches a certain picture.  If you are asked to find a parametrization for the unit circle, you now know that the answer would be:

f(t) = (cos t, sin t), 0 ≤ t ≤ 2π.

One quick comment about using ParametricPlot[].  With Mathematica v4.x, if you define a function f[t] and then plot it by typing ParametricPlot[ f[t], ......] as above, you'll see this blue error message:

This isn't a problem and you shouldn't worry about it.  If it really annoys you, ask your TA about the different ways to get rid of it.  The simplest is probably to type and evaluate the command Off[ParametricPlot::ppcom].

With Mathematica v5.0 this problem no longer exists.

Here are some other common examples of parametric equations:

Example 1.  A circle of radius r

We simply take our parametrization of the unit circle and multiply each component by r to get , 0≤t≤2π.  Before you go any further, you should use ParametricPlot to graph two different circles where r=3 and r=5.  Remember to include the AspectRatio→Automatic option if you want the result to look like a circle.

Example 2. An ellipse   + = 1

This is an ellipse centered at the origin.  To graph it by hand, you need to know that an ellipse written in this form goes through the points (±a, 0) and (0, ± b).  You would plot these four points and then try to draw a smooth ellipse through them.  Mathematica can draw this precisely using parametric equations.  (If you tried to use the Plot command you'd have the same problem as with the circle; when you solve for y you get

y =

and you'd have to graph it in two pieces.)

To parametrize the ellipse, we start with the parametrization for the unit circle, .  You can think of the variables a and b as instructions for how far to stretch/compress this circle in the x and y directions to make our ellipse.  In mathematical terms, this means we should multiply the x-component of f(t) by a, and the y-component of f(t) by b.  So the parametrization of the ellipse is 0≤t≤2π.  You can see this is similar to the parametrization for a circle of radius r, and in fact if a=b then the result is a circle!

As an example, here is the graph of the ellipse + = 1

In[169]:=

Out[169]=

Example 3. Circles and Ellipses centered away from the origin.

It's actually surprisingly easy to parametrize a circle or an ellipse which is centered at a point other than the origin.  For example, consider the circle of radius 3 centered at the point (1,-2).  If the circle were centered at the origin, its parametrization would be g(t) = (3cos t, 3sin t).  All we need to do is move all of our points 1 unit to the right and 2 units down to get the circle we want, so we add these numbers to the components of g(t):

In[170]:=

Out[170]=

Out[171]=

In general the parametrization for a circle of radius r, centered at (h,k), is f(t) = (h + r*cos t, k + r*sin t), where of course 0≤t≤2π.  You won't be surprised to find that this works for an ellipse, as well; to shift the ellipse from above so that it's centered at (1,-2), simply add 1 and -2 to the x and y components:

In[172]:=

Out[172]=

Example 4. Spirals

Consider the following function.  Try to think about what its graph will look like, and why.

In[173]:=

Out[173]=

It looks kind of like a circle of radius t, but because t is increasing, it means that instead of tracing out a circle, the graph of this function will spin out from the origin:

In[174]:=

Out[174]=

Example 5.  Straight Line Segment

One important example of a parametric equation is a straight line segment.  Instead of simply quoting a formula, let's look at an example and try to parametrize such a segment.

Suppose we have two points, P=(-1,2) and Q=(2,1).  Intuitively, what we want to do is start at the point P and travel towards the point Q.  The following picture represents this; we go from the origin to P, which is accomplished with the black arrow.  The colored arrows represent our progress towards Q; the numbers above the arrows represent how far we've gone, percentage-wise.  (So, for example, if we're at the tip of the purple arrow, we've gone 75% of the way from P to Q.)

In vector notation, the black arrow is the vector , the vector that goes from the origin to the point P.  The colored arrows are all multiples of the vector .  (Note that most of each colored arrow is covered up by the previous arrows; all of the colored arrows actually start at P.)  So once we're at the point P, we want to add on everything from 0% of to 100% of .  Since percentages are really just numbers between 0 and 1, our parametrization for the line segment between the points P and Q is:

f(t) = + t·,  where 0 ≤ t ≤ 1.

For our specific example, we have:

In[175]:=

Out[175]=

Out[176]=

To make sure you understand this process, you should parametrize the line segments from (-1,-1) to (5,1) and from (4,2) to (4,-3).  Plot them and verify that they are correct.

Example 6.  A Line

If we take the parametrization f(t) = + t· and let t range from -∞ to +∞, instead of just 0 to 1, we get the entire line containing P and Q instead of the line segment between them.  This is the parametric equation for a line.

Example 7.  The Graph of a Function y=f(x)

As we noted above, a piece of the graph of any function is a curve.  For example, the following commands all produce examples of curves.

In[177]:=

Out[177]=

In[178]:=

Out[178]=

In[179]:=

Out[179]=

There will be times when we want to represent these curves with parametric equations.  There's an easy, almost silly, way to do this.  If we want to parametrize the graph of y=g(x), we can let x be the parameter, and our parametrization is simply f(x) = (x, g(x)).  Sometimes we wish to keep t as our parameter instead of switching to x.  All we need to do is change the name of our variable, so we have f(t) = (t, g(t)).  For example, the parametrization for the first plot above goes like this:

In[180]:=

Out[180]=

Out[181]=

The resulting graph should look the same as the first graph in this example.  This leads to the obvious question, "Why go to all this trouble if you end up with the same thing?"  There are various answers to this question, but perhaps the simplest is this: later on we'll learn many wonderful things you can do with parametrizations, and we want to be sure that we can do these things to plain old regular graphs of functions..

Exercise 1

Duplicate the following picture as closely as possible by parametrizing each line segment and displaying them together.  You should turn in the parametrizations of the segments and your final picture; you do not need to hand in pictures showing the plot of each individual line segment!

Hint:  The ends of the line segments are the following points: (1,1), (5,2), (6,4), (3,7), (3,5), (0.5,4).

Exercise 2

Follow the instructions for Exercise 1 with the following picture.  The ends of the line segments are now (-2,1), (0,2), (2,1), (1,-1), and (-1,-1).

Curves in Three Dimensions

So far everything we've done has been in two-dimensional space -- in other words, everything that we've graphed has been on the xy-plane.  Mathematica can also graph parametric equations in three dimensional space.  To do this, we use a variant of ParametricPlot which is named, not surprisingly, ParametricPlot3D.

Note the capitalization in ParametricPlot3D.  If the two P's and the D are not capitalized, you will get an error message!  Also, if you want to turn off the blue error messages in Mathematica 4.x about compiled functions, you can type and evaluate the command Off[ParametricPlot3D::ppcom] — essentially the same as before, but with "3D" in it.  (Once again, you don't have to worry about this when using Mathematica 5.0.)

Also, as you might expect, we've Live-ned up the ParametricPlot3D command with an interactive version called ParametricPlot3DLive.  This is in addition to the Live commands you learned about in Lab 1B.

ParametricPlot3D expects a parametric equation with three components instead of two.  We can actually graph any of the equations above by simply letting z=0.  For example, the following commands will plot the unit circle:

In[182]:=

Out[182]=

Out[183]=

As you can see, the difference is that now Mathematica treats the circle as if it lives in three dimensions instead of two.  We can plot the unit circle for other values of z, as well:

In[184]:=

Out[184]=

Out[185]=

We can even plot all three circles together, so you can really get a feel for the added dimension:

In[186]:=

Out[186]=

The third dimension is even easier to see if you replace the Show command with ShowLive and rotate the picture a bit.

In[187]:=

Out[187]=

Of course, the z component of the function does not have to stay constant, and things get a lot more interesting if we let it change.  Here's a circle of radius 1 which is not in the xy plane.  (Which plane is it in?  The output can sometimes be a little deceiving!)

In[188]:=

Out[188]=

(To see if you really understand what plane the circle is in, you could try adding the option ViewPoint→{2,0,0} to the previous command and see if you can explain the output.  Alternaticvely, you could replace ParametricPlot3D with ParametricPlot3DLive and rotate the picture to figure out what plane it's in.)

Let's look at a few examples of curves in three-dimensional space.

Example 8.  Helix

To introduce a helix, let's look at the following function first.

In[189]:=

Out[189]=

As t moves from 0 to 2π, you can see that the x- and y-coordinates will go around the unit circle.  But our z-coordinate starts at zero and increases, so instead of a circle, we get a helix twisting upwards.

In[190]:=

Out[190]=

This helix only makes one revolution; to go around more times we can let t go from 0 to 4π, or 6π, etc.  (We want to choose a multiple of 2π because that represents a full trip around the circle.)

In[191]:=

Out[191]=

Often we write the parametrization for a helix in a slightly different form, like this:

In[192]:=

Out[192]=

Now we make a full revolution around the circle when t increases from 0 to 1, instead of 2π.  Similarly, if we let t go from 0 to 2, we would make 2 revolutions around the helix.  In general, to make n revolutions, we let t go from 0 to n.  For example, to graph a helix which makes three revolutions, using the new parametrization, evaluate the following command:

In[193]:=

Out[193]=

Note one crucial difference: in this last example, the z values range from 0 to 3.  In the previous example, the z values ranges from 0 to more than 9.  Why is this?

If we "combine" the spiral from above with the helix we can make an interesting effect that looks like a tornado:

In[194]:=

This is a little choppy, because Mathematica is letting the parameter t increase too much as it moves from point to point on the graph.  To fix this we can use the option PlotPoints in the command, which specifies how many points to use when graphing the function.  With a curve, the default is 75; if we increase this we can make the picture smoother:

In[196]:=

Out[197]=

If you really want to be able to see a difference, try letting t range up to 40 in both commands and compare your output.  We'll use this PlotPoints option for all of the graphs in the next example.

Example 10.  A Randomly Chosen Graph

This example, unlike many of the others, will probably never be used in class.  The point is just to show you that all kinds of silly things are possible -- and to continue demonstrating that we can make pretty pictures using parametric equations.

Consider the graph of this function:

In[198]:=

Out[198]=

Out[199]=

For our silly example, let's create functions whose x- and y- values will follow this graph above, but whose z-values will vary with time t, instead of just being 0.  If we do let z=0, the we just get the same graph again, but now "living" in three-dimensions:

In[200]:=

Out[200]=

Out[201]=

Now let's play around with the z values.  Try to predict what each graph will look like before evaluating the commands.  You may want to use the ShowLive or ParametricPlot3DLive functions to get a better look at some of these.

In[202]:=

Out[202]=

Out[203]=

In[204]:=

Out[204]=

Out[205]=

In[206]:=

Out[206]=

Out[207]=

In[208]:=

Out[208]=

Out[209]=

In[210]:=

Out[210]=

Out[211]=

Exercise 3

Parametrize the intersection of the cylinder + = 9 with the plane z = 4-x.  First you should plot the cylinder with the command ContourPlot3D, which was introduced in Lab 1B.  You can plot the plane using Plot3D.  Then use Show to plot them together so you can see the intersection and get an idea of what it should look like.  (Suggested ranges of x and y for plotting both the cylinder and the plane are {x,-4,4}, {y,-4,4}.  For ContourPlot3D you'll also need to specify a z range, such as {z,0,8}.)

To parametrize the curve which is the intersection, first note that the entire curve lies above the circle + = 9.  You know how to choose x(t) and y(t) so that the x- and y-values are on this circle.  All that's left is to determine what z(t) is.

In exercises 4 and 5, follow the directions for exercise three, changing the plotting ranges as needed.

Exercise 4

Parametrize the intersection of the cylinder + = 4 with the surface  z = - .

Exercise 5

Parametrize the intersection of the cylinder + = 16 with the surface  z = - .

Exercise 6

Imagine you're in a Geography professor's office and there is a globe in front of you.  Suppose you put a pen at the North Pole, start spinning the globe, and then you slowly move the pen from the North Pole to the South Pole.  You would get a picture that looks like this:

Try to replicate this picture as closely as possible.  You should turn in your parametrization, with the corresponding graph, and an explanation of how you arrived at your answer.  Simply stumbling across the correct answer will result in little credit.  You may use the following hints:

• Every point on this curve is on the unit sphere + + = 1, so when you think you have your final parametrization, you should make sure that if you square x(t), y(t), and z(t), and add them all together you'll get 1.

• There are many possible parametrizations, but in the one originally used to create this picture,  z(t)=Cos[π*t] and t goes from 0 to 1.

• Seen from the top down, the path makes twenty revolutions around the sphere.  So you could start by parametrizing a helix which makes 20 revolutions and has the z(t) component given above.  Then decide how to change x(t) and y(t).  (Extra hint: you multiply them by the same thing, something which goes from 0 to 1 and back to 0 again as t goes from 0 to 1 itself.)

• You will probably want to used the PlotPoints option for ParametricPlot3D, which was used in examples 9 and 10.  This picture was created using the option PlotPoints→400.

Exercise 7

Parametrize the following curve.  Try to replicate it as closely as possible.

You can use the following hints:

• Every point on this curve is on the double cone ,  so when you think you have your final parametrization, you should make sure that if you square x(t), and y(t) and add them together, you get .

• There are many possible parametrizations, but in the one originally used to create this picture,  z(t)=t, and t goes from -1 to 1.

• Seen from the top down, the path makes twenty revolutions around the z-axis.  So you could start by parametrizing a helix which makes 20 revolutions and has the z(t) component given above.  Then decide how to change x(t) and y(t).

Derivatives of Parametrizations

Note: depending on your instructor, you may have already seen this material as a part of an assigned reading.  In that case, you can very quickly skim through the material, but you should read about how to use the PathAnimate and PathTangentAnimate commands.  You'll be asked to use them in later labs.

For simplicity, we're only going to deal with two dimensions here, but the same ideas apply in three dimensions as well.

Suppose we have a parametrization f(t) = (x(t), y(t)), where t ranges from 0 to 10.  If we say that t represents time in seconds, then we can say f(t) represents the position of an object at time t.  For example, consider the following function:

In[212]:=

You should know by now that this is a parametrization for the unit circle.  As you learned above you can plot this function using ParametricPlot:

In[213]:=

Out[213]=

This doesn't give you a feel for what I'm telling you, however: that f(t) can be viewed as the location function for a particle moving around the unit circle, where the particle finishes its trip when t=2π seconds (or minutes, or hours, or whatever our unit is).

Try looking at the output of the following command.  It will produce an animation of the particle moving around, which is actually just a number of different pictures in rapid succession.  Your TA will demonstrate how to view the animation.  (Note: in this reading, the animation appears automatically as an aminated .gif file.)

In[214]:=

Now you can see the particle moving around the curve.  It looks as if the speed of the particle is constant; let's see if we can prove that somehow.

Recall from section 1.10 in your textbook that if f(t) represents the location of a particle at time t, then v(t)=(t), the derivative of f, represents the velocity of the particle at time t.  For example, in our case we have:

In[215]:=

v[t_] = D[f[t], t]

Out[215]=

Velocity is a little different than speed.  Speed is just a number representing how fast a particle is moving.  Velocity is a vector whose length represents speed, and whose direction represents the direction the particle is moving at that specific instance of time.

To see an animation of the particle moving around the circle along with its tangent vectors, run this command:

In[216]:=

It certainly looks as if the length of the velocity vector is constant, which would confirm that the speed of the particle is constant.  In fact, we can show this algebraically.  You should find the length of the tangent vector v(t) on paper and show that it is constant -- it does not depend on t.

Let's look at a different parametrization of the unit circle,

g(t) = (),    0≤t≤.

This is a parametrization of the unit circle because as t ranges from 0 to , ranges from 0 to 2π:

In[217]:=

Out[218]=

Now let's watch the particle whose motion is represented by :

In[219]:=

As you can see, the particle starts out very slowly and picks up speed as time goes on.  You can see this either by watching the particle itself, or by watching the length of the tangent vector grow.  (Remember, the length of the tangent vector represents the speed of the particle!)

Find the velocity of this particle by computing the derivative of g[t].  Can you see why the particle is speeding up?  You'll be asked to investigate this parametrization of the circle a little more in Lab 4A.

If you'd like to play around with these two animation commands, their syntax is:

PathAnimate[f[t],{t,tmin,tmax},n]
PathTangentAnimate[f[t],{t,tmin,tmax},n]

where n represents the number of frames to draw.  (So the bigger n is, the longer it takes to create the animation, but the smoother it looks.  40 seems to be a reasonable number for most parametrizations.  Here are a couple of parametrizations to try; you can copy these and paste them into commands:

f[t_]={Cos[t],Sin[t]^3}, {t, 0, 2Pi}        (at least 40 frames)
f[t_]={Cos[2t],Sin[3t]}, {t, 0, 2Pi}        (at least 50 frames)
f[t_]={Cos[2t],Sin[4t]}, {t, 0, 2Pi}        (at least 50 frames)
f[t_]={Cos[5t],Sin[3t]}, {t, 0, 2Pi}        (at least 100 frames)
f[t_]={t,t^2}, {t, -1,1}                    (at least 30 frames)
f[t_]={t^3,t^2}, {t, -1,1}                    (at least 30 frames)

Credits

Created by Mathematica  (November 6, 2004)