1

I want to graph x^1/2-x and the implicit function (y^0.2-y)/2=x, but I'm having trouble with the second function. I'm not sure how to plot the function using tikz, and my attempt (below) does not seem to work.

> \usepackage{pgfplots}
>     \begin{document}
>     \tikzset{declare function={f(\x)=(\x)^(1/2)-\x;}}
>     \begin{tikzpicture}[scale=0.85]
>     \begin{axis}[domain=0:0.5,ytick={1},xtick={1,2,3,4},
>     xmin=0,ymin=0,ymax=0.5,xmax=0.5,mark=none,samples=100] 
>       \addplot[black] {f(x)};
>           \draw[variable=\y,red]  plot ({(\y^0.2-\y)/2},{\y});
>     \end{axis}  
>     \draw [black, dashed] plot coordinates {(-.1,2.85) (3.4,2.85)};
>     \draw [black, dashed] plot coordinates {(3.43,-.1) (3.43,2.8)};
>     
>     \node at (3.43,-.3) {\small $1$};
>     \node at (6.5,-.3) {\small $b_1$};
>     \node at (-.23,2.85) {\small $1$};
>     \node at (-.23,5.4) {\small $b_2$};
>     \node at (5.8,3) {\small $b_2=r_2(b_1)$};
>     \node [text=red] at (4,5.4) {\small $b_1=r_1(b_2)$};
>     \end{document}
  • This is because you pass all these arguments to \draw rather than \draw plot or \addplot. – user121799 Sep 12 '18 at 16:16
  • Ah. I see. but are you sure my function will chart (y^0.2-y)/2=x? – pafnuti Sep 12 '18 at 16:19
1

Just pass these options to something appropriate like \addplot, or add plot.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\tikzset{declare function={f(\x)=(\x)^(1/2)-\x;
g(\x)=(pow(\x,0.2)-\x)/2;}}
\begin{tikzpicture}[scale=0.85]
\begin{axis}[domain=0:0.5,ytick={1},xtick={1,2,3,4},
xmin=0,ymin=0,ymax=0.5,xmax=0.5,mark=none,samples=100] 
\addplot[black] {f(x)};
\addplot[domain=0:1,red]  ({g(x)},{x});
\end{axis}  
\draw [black, dashed] plot coordinates {(-.1,2.85) (3.4,2.85)};
\draw [black, dashed] plot coordinates {(3.43,-.1) (3.43,2.8)};
\begin{scope}[font=\small]
\node at (3.43,-.3) {$1$};
\node at (6.5,-.3) {$b_1$};
\node at (-.23,2.85) {$1$};
\node at (-.23,5.4) {$b_2$};
\node at (5.8,3) {$b_2=r_2(b_1)$};
\node [text=red] at (4,5.4) {$b_1=r_1(b_2)$};
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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