Mathematics 241 – Multivariable Calculus

Lab Day 1 – More on parametric curves and visualizing other coordinate systems September 11 and 12, 2007

Goals

In these first two lab days of the semester, we want to

• Get familiar with the mechanics of the Maple computer algebra system and using the Haberlin 408 PC lab,

• Learn how to use Maple for plotting 2D and 3D parametric curves, and

• Explore some of the geometry of the polar coordinate system in R^{2}, and the cylindrical and spherical coordinate systems in R^{3}.

Maple commands for 3D parametric curve plotting

The spacecurve command in the plots package can be used to draw parametric curves in 3-dimensional space. To use it, you will need to enter the command

                           with(plots);

to begin (just once in each Maple session). The general format for the command is

               spacecurve([x(t),y(t),z(t),t=a..b]);

where x = x(t), y = y(t), z = z(t) are the parametric equations of the curve and the range of parameter values to be plotted is a ≤ t ≤ b. For instance, try entering

                 spacecurve([t,t^2,t^3,t=-2..2]);

to plot the twisted cubic curve from class.

The first plot you see here might be rather uninformative. Fortunately, Maple also lets you add axes and look at a 3D plot from different viewpoints. Here’s how:

1) Press the left mouse button over the graph. This should bring up a “bounding box” for the graph with corners you can drag and drop with the mouse to resize the graph.

2) If you place the mouse over the graph, depress the left button, and drag the cursor, you should see the graph rotating following the cursor position. Release the left mouse button when you get to the position you want.

3) If you click the right mouse button, you will bring up a menu containing the options Style, Axes, Color and several others. Select Axes, Normal with the left mouse button.

4) There are also options in this menu for changing the color of the curve plotted, setting the scales on the coordinate axes (“axes constrained” means equal scales on the three axes; the default is for Maple to choose the scales to “fill up” the graphics window as much as possible (for instance, Maple will not choose to produce a long, skinny plot even if −10 ≤ z ≤ 10 for −1 ≤ x, y ≤ 1, etc.)

Practice a few times repositioning the viewpoint (rotating the viewing box) and redrawing the graph, perhaps changing the color, and so forth.

Lab Exercise 1

Generate and display in your worksheet three separate plots showing what you see if you view the twisted cubic curve looking

a) Straight along the positive x-axis toward the origin,

b) Straight along the positive y-axis toward the origin,

c) Straight down the positive z-axis toward the origin.

d) Also, explain in a text region how your three plots relate to the three coordinate functions of the curve (t, t^{2}, t^{3}).

Note: You can also plot a parametric curve in the plane using Maple. The format for plotting a curve with parametric equations x = x(t), y = y(t) is

                         plot([x(t),y(t),t=a..b]);

(Note the placement of the square brackets which follows the same pattern as in the spacecurve command.) This generates a 2D plot similar to the plot generated by spacecurve, but without the rotation feature, etc. You may want to illustrate your assertions in part d of this question with several 2D plots.

To draw several parametric curves in the same graph, you can include several curve specifications in the form [x(t),y(t),z(t),t=a..b] between curly braces {,}, separated by commas, all inside the parentheses for the spacecurve command.

Lab Exercise 2

Recall that the line segment from (a, b, c) to (d, e, f) can be parametrized as follows

α(t) = (a, b, c) + t(d − a, e − b, f − c) = (a + t(d − a), b + t(e − b), c + t(f − c))

for 0 ≤ t ≤ 1. The points P = (0, 0, 0), Q = (2, 0, 0), R = (0, \sqrt{3}, 1), S = (0, −1, \sqrt{3}) are four corners of a cube in R^{3} with edges P Q, P R, and P S, because the vectors u⃗ = Q − P, v⃗ = R − P, w⃗ = S − P all have magnitude 2, and u⃗ · v⃗ = u⃗ · w⃗ = v⃗ · w⃗ = 0. Your assignment, should you decide to accept it (just kidding!), is to create a picture of this cube by drawing the 12 edges together on the same set of axes in R^{3} (begin by drawing the line segments from P to Q, P to R, and P to S). Also explain how you found the other 4 corners of the cube. This can be done in a text region. (Suggestion: It is probably simplest to do the necessary calculations to find the other points and the parametrizations of the edges of the cube with pencil and paper by hand. Use Maple to generate the plot and check your work.)

Other 2D and 3D plots and new coordinate systems

The Maple command for 2D plotting is called plot. This can be used for plotting graphs y = f(x), or parametric curves x = x(t), y = y(t), or curves defined in polar coordinates. For instance, to plot the polar curve r = f(θ), for α ≤ θ ≤ β, you would enter a command with this format:

              plot(f(theta),theta=alpha..beta,coords=polar);

where you supply the appropriate formula for the function f(θ) and the endpoints α, β of the range of angles you want to plot – often 0..2*Pi for θ corresponding to one full circle about the origin.

Similarly, the plot3d command can be used to plot surfaces in R^{3} of the form z = f(x, y), or r = f(θ, z) in cylindrical coordinates, or ρ = f(θ, ϕ) in spherical coordinates. The surface in R^{3} defined by a cylindrical equation of the form r = f(θ, z) (where f might only explicitly contain one of the variables) can be plotted using a command of the form

plot3d(f(theta,z),theta=alpha..beta,z=a..b,coords=cylindrical,grid=[60,60]);

Note: the grid=[60,60] at the end is optional, but you should usually include this to “smooth out” the plot. Try removing it to see what you get!

Finally, the surface in R^{3} defined by a spherical equation of the form ρ = f(θ, ϕ) (where f might only explicitly contain one of the variables) can be plotted using a command of the form

 plot3d(f(theta,phi),theta=a..b,phi=c..d,coords=spherical,grid=[60,60]);

Lab Exercise 3

a) Plot the curve in R^{2} given by the polar equation r = cos(2θ) for 0 ≤ θ ≤ 2π.

b) Plot the surface in R^{3} given by the cylindrical equation r = cos(2θ). Show the part with 0 − 1 ≤ z ≤ 1 and 0 ≤ θ ≤ 2π.

c) How are your graphs in parts a and b related? What is true in general about the curve r = f(θ) in R^{2} and the surface r = f(θ) in R^{3} in cylindrical coordinates?

d) Plot the surface in R^{3} given by the spherical equation ρ = cos(2θ). Show the part with 0 ≤ θ ≤ 2π and 0 ≤ ϕ ≤ π.

e) Plot the surface in R^{3} given by the spherical equation ρ = cos(2ϕ). Show the part with 0 ≤ θ ≤ 2π and 0 ≤ ϕ ≤ π.

f) Explain why the surfaces in parts d and e have the shapes that they do.

g) Experiment with the polar curves r = cos(nθ) for n = 3, 4, . . .. How does the shape depend on n?

h) Do the same with the surfaces ρ = cos(nθ) and ρ = cos(nϕ) in spherical coordinates.