[pstricks] Some examples of solids of revolution
Dougherty, Michael
michael.dougherty at swosu.edu
Thu Dec 22 23:44:24 CET 2016
Thanks to everyone who offered some advice on volumes of revolution graphs for calculus books. I came up with some, mostly using brute force, for instance using parametricplot for bits of ellipses and such. Here's the code. Apologies that it's not very clean or elegant, and I'm sure I'll make some changes eventually. Maybe someone will find something useful in there. (I really like fouriernc for my fonts, so I left it in.):
\documentclass[letterpaper,openany,11pt]{article}
\usepackage{fouriernc}
\usepackage{mathtools}
\usepackage{
amsmath,amsfonts,pstricks,
pst-plot,pst-text,multido}
\newcommand{\ds}{\displaystyle}
\begin{document}
%%%%%% Simple cone
\begin{pspicture}(-2,0)(2,5)
\psset{xunit=1.2cm}
\parametricplot[linestyle=dashed]{0}{180}{t cos 2 mul t sin .5 mul}
\parametricplot{180}{360}{t cos 2 mul t sin .5 mul}
\psline(-2,0)(0,5)(2,0)
\psline{*-}(0,0)(2,0)
\rput(1,0.2){$r$}
\psline(0,0)(0,5)
%\parametricplot{0}{180}%
% {t cos 2 mul 3 div 5 2 3 div mul t sin 3 div sub}
%\parametricplot{180}{360}{t cos 2 mul t sin .5 mul}
\parametricplot[linestyle=dashed]{0}{180}%
{t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2 add}
\parametricplot{180}{360}%
{t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2 add}
\parametricplot[linestyle=dashed]{0}{180}%
{t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2.1 add}
\parametricplot{180}{360}%
{t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2.1 add}
\psline[linewidth=1.5pt]{*-}(0,2)(0,5)
\rput[l]{270}(.2,3.5){$h-y$}
\psline[linewidth=1.5pt]{*-}(0,2)(1.2,2)
\rput(.625,2.2){rad}
\psline{<->}(2.2,0)(2.2,5)
\rput[l](2.4,2.5){$h$}
\rput[l](.2,1){$y$}
\psline(-2.3,2)(-1.7,2)
\psline(-2.3,2.1)(-1.7,2.1)
\psline{->}(-2,2.4)(-2,2.1)
\psline{<-}(-2,2.0)(-2,1.7)
\rput(-2,2.6){$dy$}
\psline(0,0)(.2,0)(.2,.2)(0,.2)
\end{pspicture}
\vfill
%%%%%% y=\sqrt{x}, x\in[0,4] around x-axis, disc-washer
\begin{pspicture}(-.5,-2.5)(6,2.5)
\pscustom[fillstyle=solid,fillcolor=lightgray]{%
\psplot[plotpoints=2000,linewidth=1.5pt]{0}{4}{x sqrt}
\psline(4,0)(0,0)
}
\psplot[linewidth=.5pt,plotpoints=2000]{0}{4}{0 x sqrt sub}
\psellipse(4,0)(.3,2)
\psellipse[linecolor=gray,fillstyle=solid,fillcolor=gray](1.69,0)(.12675,1.3)
%\pscustom[fillstyle=solid,fillcolor=gray]{%
\parametricplot[plotpoints=1000,linestyle=dashed]{-90}{90}%
{t cos .12675 mul 1.69 add t sin 1.3 mul}
\parametricplot[plotpoints=1000]{90}{270}%
{t cos .12675 mul 1.69 add t sin 1.3 mul}
%}
\psaxes{<->}(0,0)(-.5,-2.5)(6,2.5)
\pscustom{%\translate(5,5)
\scale{.1666 1}
\psarc[arrowscale=3 .444]{->}(28,0){1}{10}{350}
}
\psline{->}(1,.5)(1.69,0)
\rput[r](.9,.5){$x$}
\psline{->}(1.69,0)(1.69,1.3)
\psline{->}(2.48,.5)(1.69,.65)
\rput[l](2.58,.5){rad}
\end{pspicture}
\vfill
%%%% y=\sqrt{x}, x\in[0,4], around y-axis, disc/washer method
\begin{pspicture}(-6,-1)(6,2.5)
\psset{xunit=.8cm,yunit=.8cm}
\pscustom[fillstyle=solid,fillcolor=lightgray]{%
\psplot[plotpoints=2000,linewidth=1.5pt]{0}{4}{x sqrt}
\psline(4,0)(0,0)
}
\psplot[plotpoints=2000]{-4}{0}{0 x sub sqrt}
\psline(-4,0)(-4,2)
\psellipse(0,2)(4,.2)
\psellipse[linecolor=gray,fillstyle=solid,fillcolor=gray](0,1.2)(4,.2)
\psellipse[linecolor=gray,fillstyle=solid,fillcolor=white](0,1.2)(1.44,.1)
\parametricplot[plotpoints=1000,linestyle=dashed]{0}{180}{t cos 1.44 mul
t sin .1 mul 1.2 add}
\parametricplot[plotpoints=1000]{180}{360}{t cos 1.44 mul
t sin .1 mul 1.2 add}
\parametricplot[plotpoints=1000,linestyle=dashed]{0}{180}{t cos 4 mul
t sin .2 mul 1.2 add}
\parametricplot[plotpoints=1000]{180}{360}{t cos 4 mul
t sin .2 mul 1.2 add}
\psplot[plotpoints=2000,linewidth=1.5pt]{0}{1}{x sqrt}
\psplot[plotpoints=2000,linewidth=1.5pt]{1.44}{4}{x sqrt}
\psplot[plotpoints=2000]{-4}{-1.44}{0 x sub sqrt}
\psplot[plotpoints=2000]{-1}{0}{0 x sub sqrt}
\psaxes[Dy=2]{<->}(0,0)(-6,-1)(6,2.5)
\psline(-.15,1.2)(.15,1.2)
\psline{->}(1,2.5)(0,1.2)
\rput[bl](1.1,2.6){$y$}
%\rput[r](-.2,1.2){\small$y$}
\end{pspicture}
\vfill\eject
%%%%% y=\sqrt{x}, x\in[0,4] around line y=3, disc\washer method
\begin{pspicture}(-.5,-.5)(5.5,6.5)
\pscustom[fillstyle=solid,fillcolor=lightgray]{%
\psplot[plotpoints=2000,linewidth=1.5pt]{0}{4}{x sqrt}
\psline(4,0)(0,0)
}
\psaxes{<->}(0,0)(-.5,-.5)(5.5,6.5)
\psline[linestyle=dashed](4,4)(4,6)(0,6)
\psline[linestyle=dotted](-.5,3)(5.5,3)
\parametricplot[plotpoints=2000,linestyle=dashed]{-90}{90}{%
t cos .5 mul t sin 3 mul 3 add}
\psellipse[fillstyle=solid,fillcolor=darkgray](2.56,3)(.5,3)
\psellipse[fillstyle=solid,fillcolor=white](2.56,3)(.233,1.4)
\psellipse(4,3)(.167 ,1)
\psellipse(4,3)(.5,3)
\parametricplot[plotpoints=2000]{90}{270}{%
t cos .5 mul t sin 3 mul 3 add}
\psplot[plotpoints=2000,linestyle=dashed]{0}{2}{6 x sqrt sub }
\psplot[plotpoints=2000,linestyle=dashed]{2.56}{4}{6 x sqrt sub }
\psplot[plotpoints=500]{2.5}{3}{x sqrt}
\psline[linestyle=dotted](2.327,3)(3.26,3)
\rput[l](4.6,3.3){$y=3$}
\psline(2.56,-.15)(2.56,.15)
\rput(2.56,-.3){$x$}
\end{pspicture}
\vfill
%%%% y=\sqrt{x}, x\in[0,4] around x=5, disc/washer method
\begin{pspicture}(-.5,-.5)(10.5,3)
\psaxes{<->}(0,0)(-.5,-.5)(10.5,2.5)
\pscustom[fillstyle=solid,fillcolor=lightgray]{%
\psplot[plotpoints=2000,linewidth=1.5pt]{0}{4}{x sqrt}
\psline(4,0)(0,0)
}
\psplot{6}{10}{10 x sub sqrt}
\psline(6,0)(6,2)
\psellipse(5,2)(1,.2)
\psellipse[linecolor=darkgray,fillstyle=solid,fillcolor=darkgray](5,1.3)(3.31,.25)
\psellipse[linecolor=darkgray,fillstyle=solid,fillcolor=white](5,1.3)(1,.2)
\parametricplot[plotpoints=1000,linestyle=dashed]{0}{180}{t cos 1 mul 5 add
t sin .2 mul 1.3 add}
\parametricplot[plotpoints=1000]{180}{360}{t cos 1 mul 5 add
t sin .2 mul 1.3 add}
\parametricplot[plotpoints=1000,linestyle=dashed]{0}{180}{t cos 3.31 mul 5 add
t sin .25 mul 1.3 add}
\parametricplot[plotpoints=1000]{180}{360}{t cos 3.31 mul 5 add
t sin .25 mul 1.3 add}
\psplot[plotpoints=100,linecolor=white,linewidth=1.2pt]
{1.6}{2.4}{x .06 add sqrt}
\psplot[plotpoints=100,linecolor=white,linewidth=1.2pt]
{7.6}{8.4}{10 x .06 sub sub sqrt}
\psplot[plotpoints=100]{1.6}{2.4}{x sqrt}
\psplot[plotpoints=100]{7.6}{8.4}{10 x sub sqrt}
%\psline(4,0)(2,0)
%\psline(6,0)(6,2)
%\psline[linestyle=dashed](4,1)(4,2)
%\psline(4,1.3)(4,2)
\psline(4,2)(4,1.3)
\psline(6,2)(6,1.3)
\psline(4,1.115)(4,1.215)
\psline(6,1.115)(6,1.215)
\psline(-.1,1.3)(.1,1.3)
\rput[r](-.2,1.3){$y$}
\psline[linestyle=dotted](5,-.5)(5,2.5)
\psline{->}(6,2.5)(5,1.3)
\rput(6,2.7){$x=5$}
\psline{->}(3,2.5)(4,1.3)
\rput(3,2.7){$x=4$}
\psline{->}(1,2.5)(1.69,1.3)
\rput(1,2.7){$x=y^2$}
\end{pspicture}
\vfill
%%%%%%%% y=\sqrt{x}, x\in[0,4] around y-axis with shell method
\begin{pspicture}(-6,-1)(6,2.5)
\psset{xunit=.8cm,yunit=.8cm}
\psaxes[Dy=2]{<->}(0,0)(-6,-1)(6,2.5)
\psellipse[linewidth=.04cm](0,1.2)(1.44,.1)
\psline[linewidth=.04cm](-1.44,0)(-1.44,1.2)
\psline[linewidth=.04cm](1.44,0)(1.44,1.2)
\pscustom[fillstyle=solid,fillcolor=lightgray]{%
\psplot[plotpoints=2000,linewidth=1.5pt]{0}{4}{x sqrt}
\psline(4,0)(0,0)
}
\pscustom[fillstyle=solid,fillcolor=gray]{%
\parametricplot{180}{360}{t cos 1.44 mul t sin .1 mul 1.2 add}
\psline(1.44,0)(-1.44,0)}
\psplot[plotpoints=2000,linewidth=1.5pt]{0}{4}{x sqrt}
\psplot[plotpoints=2000]{-4}{0}{0 x sub sqrt}
\psaxes[Dy=2]{<->}(0,0)(-6,-1)(6,2.5)
\psline(-4,0)(-4,2)
\psline[linewidth=.04cm](1.44,0)(1.44,1.2)
\psline[linewidth=.04cm](-1.44,0)(-1.44,1.2)
\psellipse(0,2)(4,.2)
\end{pspicture}
%%%%%%% y=2\sin x^2, x\in\left[0,\sqrt{\pi}\right], around y-axis,
%%%%%%% cylindrical shell method
\begin{pspicture}(-3,-1)(3,3)
\pscustom[fillstyle=solid,fillcolor=lightgray]{%
\psplot{0}{1.772453851}
{x dup mul 180 mul 3.1415926535 div sin 2 mul}
\psline(3.1415926535,0)(0,0)
}
\psplot{-1.772453851}{0}{x dup mul 180 mul 3.1415926535 div sin 2 mul}
\psaxes{<->}(0,0)(-3,-1)(3,3)
\psellipse(0,2)(1.253314137,.1)
\psellipse[linewidth=.04cm](0,1)(0.723601255,.15)
\psline[linewidth=.04cm](0.723601255,0)(0.723601255,1)
\psline[linewidth=.04cm](-0.723601255,0)(-0.723601255,1)
\pscustom[fillstyle=solid,fillcolor=darkgray]{%
\parametricplot{180}{360}{t cos 0.723601255 mul t sin .15 mul 1 add}
\psline(0.723601255,0)(-0.723601255,0)
}
\psplot[plotpoints=2000,linestyle=dashed]{-0.723601255}{0.723601255}{x dup mul
180 mul 3.1415926535 div sin 2 mul}
\psline(1.772,-.15)(1.772,.15)
\psline[linestyle=dashed](0,0)(0,.8)
\rput(1.6,-.34){$\sqrt{\pi}$}
\psline(.7236,-.15)(.7236,.15)
\rput(.7236,-.3){$x$}
\end{pspicture}
\end{document}
More information about the PSTricks
mailing list