**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*
(
,
*z*
)
. (For more general surfaces, see Section 2 below.) The syntax is

cylinderplot( f( , z), = .. , z = c..d ) ;

This command thus works for surfaces lying above a basic "polar rectangle" [
*c*
,
*d*
]
´
[
,
] in the
*xy*
-plane: that is it consists of points whose polar coordinates satisfy
*c ² r ² d*
,
²
²
. 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);**

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*
=
and below the graph of
= 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
=
into the second:

= 4 Þ ,

which is the circle of radius
with center at the origin. In polar coordinates that is
*r*
=
.
The equation of the cone transforms to the cylindrical-coordinate equation
*z*
=
*r*
,
and the equation of the sphere transforms to
= 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*
=
is therefore needed. Letting
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);**

**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*
(
,
*z*
). However, there is a more general version of
cylinderplot
. It can plot any cylindrical-coordinate equation for which you can express
*z*
or
as a function of the remaining two variables. The extended command requires entry of the formulas for
*all three*
of
*r*
,
, 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, , z], u = a..b, v = c..d ) ;

For example, the next routine plots the two simple cylindrical surfaces with equations
*z*
=
*c*
and
=
. (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.

`> `
**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);**

`> `

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