答案1
运行pdflatex --shell-escape <file>
\documentclass{article}
%\usepackage[pspdf={-dALLOWPSTRANSPARENCY}]{pstricks-pdf}% GhostScript 9.53
\usepackage[pspdf={-dNOSAFER}]{pstricks-pdf}% < 9.53
\usepackage{pst-func}
\begin{document}
\psset{xunit=2}
\begin{pspicture}(-0.5,-4)(4,4)
\psaxes{->}(0,0)(0,-4)(3,4)
\psVolume[linecolor=black!40,fillstyle=solid,
fillcolor=yellow!40,opacity=0.4](0.5,2){12}{x sqrt 2 mul}
\psplot[algebraic,linecolor=red,linestyle=dashed]{0}{2}{2*sqrt(x)}
\psplot[algebraic,linecolor=red,linestyle=dashed]{0}{2}{-2*sqrt(x)}
\psplot[algebraic,linecolor=red,linewidth=1pt]{0.5}{2}{2*sqrt(x)}
\pscustom[opacity=0.4,fillstyle=solid,fillcolor=red,linestyle=none]{%
\psplot[algebraic]{0.5}{2}{2*sqrt(x)}
\psline(2,0)(0.5,0)}
\uput[0](2.1,2.8){\textcolor{red}{$y=2\cdot\sqrt{x}$}}
\psline(2,0)(3,0)
\end{pspicture}
\end{document}