# Cylindrical Coordinates in MathematicaCopyright © 1995, 1997, 2003 by James F. Hurley, Department of Mathematics, University of Connecticut, Unit 3009, Storrs, CT 06269-3009. All rights reserved

1.  Basics. The standard package Graphics`ParametricPlot3D`contains commands for 3-dimensional plotting of regions with cylindrical-coordinate descriptions. This notebook discusses cylindrical-coordinate plotting.

The cylindrical coordinate system is just the hybrid that results from crossing polar coordinates in the
xy-plane with the ordinary vertical Cartesian coordinate z. To distinguish them readily from Cartesian coordinates, the cylindrical coordinates of points in this notebook are in square brackets. An expression of the form P(x, y, z) = P[r,θ, z] means that a point P(x, y, z) has cylindrical coordinates r, θ, and z.

It is easy to generate plots of the basic cylindrical surfaces
z = c, r = c, and θ = k, where c and k are constants. Note that the plot of a horizontal plane z = 3 looks circular, not like the parallelogram one sees in a Cartesian plot. That is so because the intersection of a cylinder r = c with the horizontal plane z = k is a circle of radius c. As usual, to produce such a plot, position your cursor at the end of the last line of code below, and hit the Enter key (or press Shift-Return).

``Needs["Graphics`ParametricPlot3D`"]CylindricalPlot3D[3, {r, 0, 4}, {theta, 0, 2 Pi},                   AxesLabel -> {x, y, z}] ``

Mathematica's CylindricalPlot3D command can only plot surfaces that are the graphs of equations z = f(r, θ), so to plot the cylindrical-coordinate equation r = c it is best to parametrize the surface. A natural way to do so is to let x = c cos θ, y = c sin θ, and z = v, where θ  varies over [0, 2π] and v ranges over any convenient interval [a, b]. The following plot uses that approach. To use it, note that you do not have to call the graphics package ParametricPlot3D.

``ParametricPlot3D[{4 Cos[u], 4 Sin[u], v},                  {u, 0, 2 Pi}, {v, 0, 5},                  AxesLabel -> {x, y, z} ]``

A convenient way to plot θ = k is also via a parametrization of the surface, which in this case is a vertical plane through the line θ = k in the xy-plane. In this case, making a parametrization is somewhat more challenging. One way is to let x = u cos k, y = u sin k, and z = v, where again u and v range over some convenient intervals.

``ParametricPlot3D[{u Cos[1], u Sin[1], v}, {u, 0, 4},                  {v, 0, 4}, AxesLabel -> {x, y, z}]``

# Next, let's plot a basic prismoidal cylindrical-coordinate solid that lies between cylinders r = a and r = b, planes θ = α and θ = β, and planes z = c and z = d. To do so, we can combine the plotting of the last three figures. For display purposes, the next routine avoids very small ranges of the three cylindrical-coordinate variables. It is instructive to watch the final picture as it combines all the planes and cylindrical pieces. Warning: Generating all the plots associated with the following commands requires a significant amount of RAM. If you have problems, increase memory allocations to Mathematica and its kernel. Executing the followintg block of code should produce as final image the region below that immediately follows the code.

``Needs["Graphics`ParametricPlot3D`"]CylindricalPlot3D[3, {r, 2, 3}, {theta, Pi/6, Pi/3}];CylindricalPlot3D[4, {r, 2, 3}, {theta, Pi/6, Pi/3}];ParametricPlot3D[{u Cos[Pi/6], u Sin[Pi/6], v},                  {u, 2, 3}, {v, 3, 4}];ParametricPlot3D[{u Cos[Pi/3], u Sin[Pi/3], v},                  {u, 2, 3}, {v, 3, 4}];ParametricPlot3D[{2 Cos[u], 2 Sin[u], v},                  {u, Pi/6, Pi/3}, {v, 3, 4}]ParametricPlot3D[{3 Cos[u], 3 Sin[u], v},                  {u, Pi/6, Pi/3}, {v, 3, 4},                  AxesLabel -> {x, y, z}]Show[%, %%, %%%, %%%%, %%%%%, %%%%%%,      AxesLabel -> {x, y, z}]``

2.  Examples. To illustrate the process of using Mathematica to plot regions with cylindrical-coordinates descriptions, we examine two such regions.

Example 1. The region D in the xz-plane between the x-axis and the graphs of z = ${x}^{2}$ and x = 2 is revolved about the z-axis to form a solid of revolution popular in second-semester calculus volume problems.

``Plot[x^2, {x, 0, 2},      PlotStyle -> Text[FontForm["D",{"Times-Italic",                       12}],{1.5, 1} ] ];ListPlot[{{2, 0}, {2, 4}}, PlotJoined -> True,           PlotStyle -> RGBColor[1, 0, 0] ];Show[%, %%, AxesLabel -> {x, z} ]   ``

Solution. The above code produces a figure that shows the region D. Fact: Revolving the graph of x = ${z}^{1/2}$ about the z-axis generates a paraboloid of revolution with Cartesian equation ${x}^{2}+\phantom{\rule{0.3em}{0.3ex}}{y}^{2}$ = z, In cylindrical coordinates that becomes z = ${r}^{2}$ . Similarly, revolution of the line x = 2 about the z-axis generates the right circular cylinder whose equation is ${x}^{2}+\phantom{\rule{0.3em}{0.3ex}}{y}^{2}$ = 4, that is, ${r}^{2}$ = 4. In the presence of the restriction r >= 0, that simplifies to r = 2. A parametric representation of this surface results from letting

x = 2 cos u, y = 2 sin u, and z = v.

The idea is that the circular portion sweeps out as u varies over [0, 2π], and the vertical part as v varies. The following routine plots the paraboloid and the cylinder. Watching the pictures generate helps you see how the region S lies between the two surfaces whose plots follow: inside the cylinder r = 2 and outside the paraboloid z = ${r}^{2}$ . (The final plot shows only half the region, so that hidden-line removal does not erase the inner surface.) Execute the routine to watch the final plot take shape.

``Needs["Graphics`ParametricPlot3D`"]CylindricalPlot3D[r^2, {r, 0, 2}, {theta, 0, Pi}];ParametricPlot3D[{2 Cos[u], 2 Sin[u], v},                  {u, 0, Pi},{v, 0, 4}]Show[%, %%, AxesLabel -> {x, y, z}] ``

Example 2.  Plot the region U bounded by the graphs of z = 0, z = y, and ${x}^{2}+\phantom{\rule{0.3em}{0.3ex}}{y}^{2}$ = 1.

Solution. The following code produces a Mathematica plot of half the region. As before, it is instructive to watch the final plot evolve. Execute the code to do so:

``Needs["Graphics`ParametricPlot3D`"]CylindricalPlot3D[r Sin[theta], {r, 0, 2}, {theta, 0, Pi}] ;ParametricPlot3D[{Cos[u], Sin[u], v}, {u, 0, Pi},                   {v, 0, 2}];Show[%, %%, AxesLabel -> {x, y, z}]``

The sequence of figures shows clearly that the region U is symmetric with respect to the xy-plane: the portion of U above that plane is congruent to the portion below it.

Converted by Mathematica      May 28, 2003