Plotting in Cylindrical Coordinates

Plotting graphs where the domain of the function has a circular domain is best done using polar coordinates in the xy plane. In three space, this is called cylindrical coordinates. In the plots library, there is a command called cylinderplot that simplifies plotting graphs using cylindrical coordinates.

> with(plots);

Warning, the name changecoords has been redefined

[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...

For example, if we want to plot the top half of the sphere with equation x^2 + y^2 + z^2 = 16, we solve for z and obtain z = sqrt (16 - x^2 - y^2) or z = sqrt (16 - r^2). Now we draw the graph parametrically, as follows:

> cylinderplot([r,theta,sqrt(16-r^2)],r=0..4,theta=0..2*Pi);

[Maple Plot]

Next, let us draw the cylinder x^2 + y^2 = 2. In this cylinder, the radius r is always 2. We let theta vary from 0 to 2*Pi as usual, and let z range from 0 to 4 to match the the height of the sphere that we just drew.

> cylinderplot([2,theta,z],theta=0..2*Pi,z=0..4);

[Maple Plot]

Now we can combine the two graphs on one set of axes by assigning each plot to a variable using a colon at the end of the command instead of a semicolon to avoid seeing the printing of a bunch of information that we don't care to see, and then using display to show both graphs.

> u:=cylinderplot([r,theta,sqrt(16-r^2)],r=0..4,theta=0..2*Pi):

> v:=cylinderplot([2,theta,z],theta=0..2*Pi,z=0..4):

> display(u,v);

[Maple Plot]

The cone z = sqrt(x^2 + y^2) can be drawn as follows. In cylindrical coordinates, the equation of the top half of the cone becomes z = r. We draw this from r = 0 to 1, since we will later look at this cone with a sphere of radius 1.

> cylinderplot([r,theta,r],r=0..1,theta=0..2*Pi);

[Maple Plot]

Now we save this in a variable

> w := cylinderplot([r,theta,r],r=0..1,theta=0..2*Pi):

Next we draw and save the graph of the top half of a sphere with radius 1, and then display are two saved graphes on one set of axes.

> s := cylinderplot([r,theta,sqrt(1-r^2)],r=0..1,theta=0..2*Pi):

> display(w,s);

[Maple Plot]