仅使用 tikz 的圆柱体

仅使用 tikz 的圆柱体

我得到的几乎都是我想要的。

\documentclass[a4paper,12pt]{report}
\usepackage{tikz}


\begin{document}

\begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);
\draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};
\draw[->] (0,-0.25)--(0,1.25) node[above]{$y$};
\draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;
\draw (0,0) node[below left]{$0$};
\draw (1,3pt)--(1,-3pt) node[below]{$1$};
\draw[red,dashed] (0.5,0)--(0.5,0.71);
\draw (0.5,3pt)--(0.5,-3pt) node[below]{$x$};
\end{tikzpicture}

\begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);
\draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};
\draw[->] (0,-0.25)--(0,1.25) node[above]{$y$};
\draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;
\draw (0,0) node[below left]{$0$};
\draw (1,3pt)--(1,-3pt) node[below]{$1$};
\filldraw[color=black,fill=red!40] (.45,0) rectangle (.55,.71);
\draw[fill=black] (.5,0) node[below]{$(x,0)$} circle (1pt);
\draw[fill=black] (.5,.71) node[above]{$(x,\sqrt{x})$} circle (1pt);
\end{tikzpicture}

\begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{-sqrt(\x)})--(1,0)--(0,0);
\draw[fill=gray!50] (1,0) circle [x radius=.1,y radius=1];
\draw[fill=red!40] (.45,0) circle [x radius=.1,y radius=.71];
\draw[fill=red!40] (.55,0) circle [x radius=.1,y radius=.71];
\draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};
\draw[->] (0,-1.25)--(0,1.25) node[above]{$y$};
\draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;
\draw[->] plot [domain=0:1.25,samples=200] (\x,{-sqrt(\x)}) ;
\draw (0,0) node[below left]{$0$};
\draw (1,3pt)--(1,-3pt) node[below]{$1$};
\end{tikzpicture}


\end{document}

这给了我这些图像。

在此处输入图片描述

第三张图是我需要帮助的地方。当第二张图中的矩形绕 x 轴旋转时,两个红色椭圆需要组合起来形成一个圆柱体。

有什么想法或建议吗?

PS 我希望严格在 tikz、pgf 中执行此操作,而不是其他 pgf 包。

谢谢。

PS 看起来我有一个可行的技巧,将第三张图片更改为:

\begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{-sqrt(\x)})--(1,0)--(0,0);
\draw[fill=gray!50] (1,0) circle [x radius=.1,y radius=1];
\draw[fill=red!40] (.45,0) circle [x radius=.1,y radius=.71];
\fill[red!40] (.45,-.71) rectangle (.55,.71);
\draw[fill=red!40] (.55,0) circle [x radius=.1,y radius=.71];
\draw (.45,.71)--(.55,.71);
\draw (.45,-.71)--(.55,-.71);
\draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};
\draw[->] (0,-1.25)--(0,1.25) node[above]{$y$};
\draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;
\draw[->] plot [domain=0:1.25,samples=200] (\x,{-sqrt(\x)}) ;
\draw (0,0) node[below left]{$0$};
\draw (1,3pt)--(1,-3pt) node[below]{$1$};
\end{tikzpicture}

结果是这样的。

在此处输入图片描述

答案1

这是大卫的解决方案(已编辑到问题中)作为答案:

TikZ 代码

\begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);
\fill[blue!20] plot[domain=0:1,samples=200] (\x,{-sqrt(\x)})--(1,0)--(0,0);
\draw[fill=gray!50] (1,0) circle [x radius=.1,y radius=1];
\draw[fill=red!40] (.45,0) circle [x radius=.1,y radius=.71];
\fill[red!40] (.45,-.71) rectangle (.55,.71);
\draw[fill=red!40] (.55,0) circle [x radius=.1,y radius=.71];
\draw (.45,.71)--(.55,.71);
\draw (.45,-.71)--(.55,-.71);
\draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};
\draw[->] (0,-1.25)--(0,1.25) node[above]{$y$};
\draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;
\draw[->] plot [domain=0:1.25,samples=200] (\x,{-sqrt(\x)}) ;
\draw (0,0) node[below left]{$0$};
\draw (1,3pt)--(1,-3pt) node[below]{$1$};
\end{tikzpicture}

输出

在此处输入图片描述

相关内容