Cylindrical and Spherical Coordinates
In cylindrical coordinates, the
xy
-plane is transformed to polar coordinates, thus resulting in points in 3 dimensions being located using the polar variables
r
and
, along with the vertical displacement
z.
To plot a function
in cylindrical coordinates, we simply add the option "coords=cylindrical" to the plot3d command. For example, let's plot the function
r=
1 in cylindrical coordinates.
> | plot3d(1,theta=0..2*Pi,z=-1..1,coords=cylindrical); |
> |
In cylindrical coordinates, r is the distance to the given point from the z -axis. Thus, the graph in cylindrical coordinates of the function r = k for k constant is a cylinder, as is illustrated by the graph of the function r= 1 above. Let's look at another example.
Example:
Let's graph the function
in cylindrical coordinates for
= 0..6
and for
z=
-1..1.
> | plot3d(theta/2+1,theta=0..6*Pi,z=-1..1,coords=cylindrical); |
> |
Notice that the result is less than satisfactory because the partition of the interval for
is too coarse. Let's try again
> | plot3d(theta/2+1,theta=0..6*Pi,z=-1..1,coords=cylindrical,grid=[80,10]); |
> |
In spherical coordinates, a point
P
is located in three dimensional space using the distance from the origin to
P,
the polar angle
, and the angle
formed with the positive
z
-axis.
To plot a function
in spherical coordinates, we use the plot3d command with the option "coords = spherical". For example, the graph of
=
k
where
k
is constant is a sphere of radius
k
, as we illustrate below by plotting
.
> | plot3d(1,theta=0..2*Pi,phi=0..Pi,coords=spherical,scaling = constrained, axes = normal); |
As another example, let us graph the spherical function
.
> | plot3d(sec(phi),theta=0..2*Pi,phi=0..Pi,coords=spherical,axes=normal,view=[-1..1,-1..1,0..2]); |
> |
Surprised? The function
is the same as
, which in cartesian coordinates is
z
= 1.