SurfRevol: A Mathematica Notebook

Plotting Surfaces of Revolution in
Mathematica

Copyright © 1999, 2001 by James F. Hurley, University of Connecticut, Department of Mathematics, 196 Auditorium Rd, Unit 3009, Storrs CT 06269-3009.  All rights reserved.

This notebook is in the Math 116 folder, within the Math Lab folder of the volume Workspace in MSB 203.

Mathematica
has a built-in package to plot surfaces of revolution. Its basic syntax is:

             Needs["Graphics`SurfaceOfRevolution`"]
      SurfaceOfRevolution[f[x], {x, a, b}]


Those commands will plot the graph of the surface in [Graphics:Images/SurfRev_gr_1.gif] that results from revolving the graph of y = f(x) about the y-axis in the xy-plane. To specify the x-axis as axis of revolution, add

             RevolutionAxis -> {1, 0, 0}]

inside the SurfaceOfRevolution command. The following string of examples illustrate how to use these commands. You can modify them to generate pictures of surfaces that appear in homework exercises.

1. Consider first the surface of revolution that results from revolving the graph of y = [Graphics:Images/SurfRev_gr_2.gif]for x in the interval [0, 1] about the x-axis in the xy-plane. To generate a plot from the following code, position the cursor at the end of the block of blue commands, the press the Enter key (or press the Shift and Return keys together).

Needs["Graphics`SurfaceOfRevolution`"]
SurfaceOfRevolution[x^(1/2), {x, 0, 1},
                     RevolutionAxis -> {1,0,0}]    

For a more elongated plot, which resembles Figure 6(b) of Section 6.2 of Stewart's Calculus, 4th Ed., enlarge the range of x-values and generate the plot as before.

[Graphics:Images/SurfRev_gr_3.gif]

[Graphics:Images/SurfRev_gr_4.gif]

[Graphics:Images/SurfRev_gr_5.gif]


To add labels on the coordinate box that surrounds the surface, use the following slight modification.

[Graphics:Images/SurfRev_gr_6.gif]

For a wider x-view, specify a larger plot range on x, y, and z (the third coordinate variable in 3-space). Execute the following code to see how that works.

[Graphics:Images/SurfRev_gr_7.gif]

[Graphics:Images/SurfRev_gr_8.gif]

[Graphics:Images/SurfRev_gr_9.gif]

Note: actually, Mathematica plots the surface of revolution as the graph of x = [Graphics:Images/SurfRev_gr_10.gif]in the xz-plane, revolved about the z-axis. This three-dimensional point of view, which Math 210 and 220 develop in detail, labels the vertical coordinate axis as the z-axis. In single-variable calculus, the vertical axis normally carries the label y. This accounts for the unusual specification of labels above. The blank between x and y in the brace suppresses a label on the "front-back" direction. Listing y last puts that label on the vertical axis.

2. To revolve about the y-axis, you could use RevolutionAxis --> {0, 1, 0}. However, the y-axis is the default axis of revolution for the SurfaceofRevolution command, so you can simply omit the RevolutionAxis command. The following routine illustrates this by plotting the result of revolving the graph of y = [Graphics:Images/SurfRev_gr_11.gif]between y = 0 and y = 8 about the y-axis. Execute it as before, and compare the output with Figure 7(b), Section 6.2 of Stewart.

[Graphics:Images/SurfRev_gr_12.gif]

[Graphics:Images/SurfRev_gr_13.gif]

[Graphics:Images/SurfRev_gr_14.gif]

3. Exercise 6, Section 6.2, p. 387. The curve x = y -- [Graphics:Images/SurfRev_gr_15.gif] in the xy-plane is revolved about the y-axis (x = 0).

Since the Mathematica command to plot a surface of revolution requires a formula in the form y = f(x), to plot this surface of revolution, you need to solve the equation of the curve for y in terms of x. To do so, rewrite the equation as a quadratic equation in y and use the quadratic formula to solve for y:

                                               
[Graphics:Images/SurfRev_gr_16.gif].

Mathematica can check such work for you:                                                                      

[Graphics:Images/SurfRev_gr_17.gif]
[Graphics:Images/SurfRev_gr_18.gif]

Via its ImplicitPlot command, Mathematica can acutally plot the curve without expressing y as a function of x. However, to generate the plot it is helpful to know that x cannot exceed 1/4. Thus the work in solving the equation for y is not wasted! The following routine gives a picture of the region whose revolution produces the surface. Note that Mathematica chooses very different scaling for the two coordinate axes.

[Graphics:Images/SurfRev_gr_19.gif]

[Graphics:Images/SurfRev_gr_20.gif]


The final routine generates plots for the top and bottom halves of the surface of revolution, which correspond to the choice of sign of the radical in the formula for
y. The last line of code merges the two separate partial surfaces into a plot of the complete surface of revolution.

[Graphics:Images/SurfRev_gr_21.gif]

[Graphics:Images/SurfRev_gr_22.gif]

[Graphics:Images/SurfRev_gr_23.gif]


Converted by Mathematica      February 1, 2002