Spherical and Cylindrical Coordinates

Visualizations

We can think of the new coordinate systems (spherical and cylindrical) as paramerizations of the cartesian coordinates. This thought helps us construct plots of 3D surfaces easily.

Here is the sphere plotted using its cartesian parametric representation (the parameterization is in terms of theta and phi, the angles the book uses in spherical coordinates).

rho = 2;
ParametricPlot3D[{rho Sin[phi] Cos[theta],rho Sin[phi] Sin[theta],rho Cos[phi]},{theta,0,2Pi},{phi,0,Pi}]

We can transform an equation between the cartesian, spherical, and cylindrical, as the following examples for the cone shows.

Example of transforming z=(Sqrt[(x^2)+(y^2)])to different coordinate systems

Here is the cone z=(Sqrt[(x^2)+(y^2)]), -2<x<2, -2<y<2  in the cartesian parametric coordinates. Notice how we cannot easily get the proper "circular top" on our cone using this parameterization. What we really want is -(Sqrt[(2^2)-(x^2)])< y <(Sqrt[(2^2)-(x^2)]).

ParametricPlot3D[{x,y,Sqrt[x^2+y^2]},{x,-2,2},{y,-2,2}]

Here is the cone ϕ=π/4 in the spherical parameterization:

Clear[rho,theta,phi]
phi= Pi/4;
ParametricPlot3D[{rho Sin[phi] Cos[theta],rho Sin[phi] Sin[theta],rho Cos[phi]},{theta,0,2Pi},{rho,0,2Sqrt[2]}]

Here is the cone r=z in the cylindrical parameterization:

Clear[rho,theta,pi,r,z]
r=z;
ParametricPlot3D[{r Cos[theta],r Sin[theta],z},{theta,0,2Pi},{z,0,2}]

Examples of some built-in Mathematica commands to plot

Knowing that different coordinate systems allow us to express surfaces with spherical or cylindrical symmetry very simply, it should not surprise us that Mathematica has the ability to plot directly in terms of these coordinates.

NOTE THAT THE ANGLES IN THE SPHERICAL COORDINATES ARE SWITCHED IN Mathematica!

The angle θ measures off the z-axis, and ϕ is measured in the  x y-plane. This notation is also very common, especially in physics

Here is the sphere ρ=2 in spherical coordinates:

Clear[r,rho,theta,phi]
SphericalPlot3D[2,{theta,0,Pi},{phi,0,2Pi}]

Here is a more wobbly surface using cylindrical coordinates. Notice that here, too, Mathematica uses phi to represent the polar angle, whereas we use theta.

Clear[theta,r,phi]
RevolutionPlot3D[r ((Cos[phi])^2) Sin[phi],{r,0,10},{phi,0,2 π}]

Here is the cone r=z in cylindrical coordinates:

RevolutionPlot3D[r,{r,0,10},{phi,0,2 π}]

I personally prefer using ParametricPlot3D rather than these built-in commands.

Looking ahead to Integration

The volume of our cone, which we know should be (h^3)π/3 (notice that we have to change the INTEGRAND when we change coordinate systems. This is due to the volume element dV changing, much like how we saw dA= dx dy = r dr dθ in (ℝ^2) when moving from cartesion to polar coordinates.

In CYLINDRICAL COORDINATES:

Integrate[ Integrate[ Integrate[ 1 r,{r,0,z}],{theta,0,2Pi}],{z,0,h}]

In CARTESIAN COORDINATES (takes awhile to run!):

Integrate[ Integrate[ Integrate[ 1,{x,-(Sqrt[(z^2)-(y^2)]),(Sqrt[(z^2)-(y^2)])}],{y,-z,z}],{z,0,h},Assumptions->{h>0}]

The other representation:

Integrate[ Integrate[ Integrate[ 1,{z,(Sqrt[(x^2)+(y^2)]),h}],{y,-(Sqrt[(h^2)-(x^2)]),(Sqrt[(h^2)-(x^2)])}],{x,-h,h},Assumptions->{h>0}]

Converting Surfaces Between Representations

From spherical to cartesian

Let Mathematica know the spherical relations:

Clear[ρ,θ,ϕ ,x,y,z]
ρ = Sqrt[ x^2 +y^2+z^2];
θ = ArcTan[y/x];
ϕ = ArcCos[z/Sqrt[x^2+y^2+z^2]];

Use Mathematica to transform the equation from spherical to cartesian:

eq = ρ Cos[ϕ] == ρ^2Sin[ϕ]^2 Cos[2θ]

Simplify the result:

FullSimplify[%]

We see that the function is a hyperbolic paraboloid.

From cartesian to spherical

Let Mathematica know the spherical relations:

Clear[ρ,θ,ϕ ,x,y,z]
x=ρ* Sin[ϕ ]* Cos[θ];
y=ρ* Sin[ϕ ]* Sin[θ];
z=ρ* Cos[ϕ ];

Use Mathematica to transform the equation from spherical to cartesian:

eq = (x^2)+(y^2)+(z^2)+4z+5y

Simplify the result:

FullSimplify[%]