Cylindrical Coordinate Plotting with Maple

Copyright 2001 by James F. Hurley, University of Connecticut Department of Mathematics, Unit 3009, Storrs CT 06269-3009. All rights reserved.

The interactive version of this worksheet is in the Math 210 folder in the Workspace volume in MSB 203. For instructions on accessing that remotely, see the Space Curves worksheet.

1. Plots via cylinderplot . The plots library has the command cylinderplot that directly plots surfaces with cylindrical-coordinate equations r = f ( theta , z ) . (For more general surfaces, see Section 2 below.) The syntax is

cylinderplot( f( theta , z), theta = alpha .. beta , z = c..d ) ;


This command thus works for surfaces lying above a basic "polar rectangle" [
c , d ] [ alpha , beta ] in the xy -plane: that is it consists of points whose polar coordinates satisfy c r d , alpha theta beta . In particular, it can handle only one of the three basic equations coordinate variable = constant , namely the right circular cylinder r = k. The next routine illustrates this for the case k = 4 . As usual, execute it by placing your cursor after the last semicolon and hitting the Enter key.

> with (plots):
cylinderplot (4, theta = 0..2*Pi, z = 0..5, axes = boxed);

Warning, the name changecoords has been redefined


As before it is often helpful to include plots of the three Cartesian coordinate axes. The following routine generates such a plot.

> with (plots):
surf := cylinderplot (4, theta = 0..2*Pi, z = 0..5, axes = boxed):
xaxis := spacecurve([t, 0, 0, t = -5..5, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -5..5, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -1..6, color = magenta]) :
labx := textplot3d([5.1, 0, -.2, `x`], color = magenta):
laby := textplot3d([0,5.1, -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 6.1, `z`], color = magenta):
display(surf, xaxis, yaxis, zaxis, labx, laby,labz);

[Maple Plot]


Despite its limitations, the
cylinderplot command is powerful enough to provide plots of many simple regions.

Example 1 . Plot the ice cream cone that lies above the graph of z = sqrt(x^2+y^2) and below the graph of x^2+y^2+z^2 = 4.

Solution . The following routine, which is a slight modification of the preceding one, plots the region. In coding it, the first step was finding the curve C of intersection of the cone and the sphere. To get the equation of C , square the first equation and then substitute z^2 = x^2+y^2 into the second:

x^2+y^2+x^2+y^2 = 4 x^2+y^2 = 2 ,


which is the circle of radius
sqrt(2) with center at the origin. In polar coordinates that is r = sqrt(2) . The equation of the cone transforms to the cylindrical-coordinate equation z = r , and the equation of the sphere transforms to r^2+z^2 = 4. Since all the ice cream lies above the cone in particular, above the xy- plane in solving the equation of the sphere for r, only the positive square root r = sqrt(4-z^2) is therefore needed. Letting theta range just from 0 to lets us peek inside the interior the region, which later will help reveal the proper limits of integration. (Note that the plot makes clear that the roof of the region is the green spherical surface.) Rotation of the default plot again gives a better image. Experiment with rotation until you get a good view.

> with (plots):
surf1 := cylinderplot (z, theta = 0..Pi, z = 0..sqrt(2), axes = boxed, color = red):
surf2 := cylinderplot (sqrt(4 - z^2), theta = 0..Pi, z = 0..2):
xaxis := spacecurve([t, 0, 0, t = -2..2, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -2..2, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -1..3, color = magenta]) :
labx := textplot3d([2.1, 0, -.2, `x`], color = magenta):
laby := textplot3d([0,2.1, -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 3.1, `z`], color = magenta):
display(surf1, surf2, xaxis, yaxis, zaxis, labx, laby,labz);

[Maple Plot]


2. More general surfaces and regions . The basic cylinderplot command can graph a surface only if its cylindrical-coordinate equation has the form r = f ( theta , z ). However, there is a more general version of cylinderplot . It can plot any cylindrical-coordinate equation for which you can express z or theta as a function of the remaining two variables. The extended command requires entry of the formulas for all three of r , theta , and z (in that order and within square brackets) as well as specification of the range of the two independent variables. Using the generic symbols u and v for those, the syntax of the extended command is thus

cylinderplot( [r, theta , z], u = a..b, v = c..d ) ;


For example, the next routine plots the two simple cylindrical surfaces with equations
z = c and theta = kappa . (In the second plot, if you change to multiples of , the initial rendering appears edge-on, so click and rotate the plot slightly to see the plane.)

> with (plots):
cylinderplot( [r, theta, 3], r = 0..2, theta = 0..2*Pi, axes = boxed );
cylinderplot( [r, 2, z], r = 0..2, z = 0..3, axes = boxed );


The concluding example of this document involves a region whose bounding surfaces need the extended cylinderplot command.
Example 2 . Plot the region E in the first octant between the graphs of x^2+y^2 = 2*x and z^2 = x^2+y^2 .

Solution . The first equation transforms to the simple polar equation r^2 = 2*r*cos*theta , that is, r = 2*cos*theta . (Cancelling r does not lose the origin, because it occurs with coordinates [0, /2].) The second equation transforms to the pair of cylindrical-coordinate equations z = r and z = r . Since E lies in the first octant, only the first applies here. The following routine plots E , with coordinate axes, and again provides a look inside the region. Again, after executing the command, you can rotate the initial plot to get a good view of E 's interior.

> with (plots):
surf1 := cylinderplot (2*cos(theta), theta = 0..Pi/2, z = 0..2, axes = boxed):
surf2 := cylinderplot ( [r, theta, r], r = 0..2, theta = 0..Pi/2, color = red):
xaxis := spacecurve([t, 0, 0, t = 0..2, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = 0..2, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = 0..2.5, color = magenta]) :
labx := textplot3d([2.1, 0, -.2, `x`], color = magenta):
laby := textplot3d([0, 2.1, -.2, `y`], color = magenta):
labz := textplot3d([0, .2, 2.2, `z`], color = magenta):
display(surf1, surf2, xaxis, yaxis, zaxis, labx, laby,labz);

[Maple Plot]

>


From the figure, observe that the roof of the region is the red conical surface. (Such observations are the key to finding correct limits of integration later.)