Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have just about what I want.

\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}

Which gives me these images.

enter image description here

The third image is where I need help. The two red ellipses need to be combined to create a cylinder when the rectangle in the second figure is revolved about the x-axis.

Any thoughts or suggestions?

P.S. I'd like to do this strictly in tikz, pgf, not another pgf package.

Thanks.

P.S. Looks like I have a technique that works, changing the third picture to:

\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}

Here is the resulting picture.

enter image description here

share|improve this question
1  
We'd like to keep answers separate from questions, so you should write a separate answer instead of editing your answer into the question. Self-answers are perfectly admissible, and a well-written answer may earn you additional reputation. –  Paul Gessler Jan 30 at 1:40
1  
David, would you consider writing a self-answer for this question? You could simply copy-paste your latest code and output sections. –  Paul Gessler Feb 23 at 22:19

1 Answer 1

This is David's solution (which was edited into the question) as an answer:

The TikZ Code

\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}

The Output

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.