# How to plot solids of revolution

Hi,

Is it possible to plot the solid generated by revolving a curve about a line?

For example, I want to see what kind of solid is generated from this question:

Use shells to find the solid generated from the region in the 1st quadrant bounded by $y=x$ and $y=x^2$, revolved about $x=-1$.

The volume of the solid is $\frac{\pi}{2}$. How can I view this solid? I checked the sage calculus tutorial for clues but couldn't find any.

edit retag close merge delete

Sort by » oldest newest most voted It might take a bit of tweaking to get what you want, but one option is to take a look at the semi-secret function revolution_plot3d. The documentation (help(revolution_plot3d) or revolution_plot3d?) has an example which is similar to yours but still different:


sage: line=u
sage: parabola=u^2
sage: sur1=revolution_plot3d(line,(u,0,1),opacity=0.5,rgbcolor=(1,0.5,0),show_curve=True,parallel_axis='x')
sage: sur2=revolution_plot3d(parabola,(u,0,1),opacity=0.5,rgbcolor=(0,1,0),show_curve=True,parallel_axis='x')
sage: (sur1+sur2).show() which produces the above picture. You could also do it with parametric_plot3d/implicit_plot3d, but you'd have to do the revolution manually (i.e. multiply x, y, and z by the appropriate trigonometric functions).

more

I think cylindrical_plot3d might be what you're looking for. Convert your equations to give x as a function of y, and then use this to compute the radius for each value of y. Of course you also need to compute where your equations intersect to get the appropriate bounds for y. I've omitted this step for now . . .

sage: var('y,theta')
(y, theta)
sage: s1 = cylindrical_plot3d(y+1,(theta,0,3*pi/2),(y,0,1), opacity=1, aspect_ratio=1)
sage: s2 = cylindrical_plot3d(sqrt(y)+1,(theta,0,3*pi/2),(y,0,1), opacity=.5, color='red')
sage: s1+s2 (Note, in this version I just let theta run from 0 to 3*pi/2 so you could see just part of the revolved surfaces. Go all the way to 2*pi to see the entire object.)

more