# A function is not being plotted on part of its domain [duplicate]

I have specified that the function x(1 - x)^{1/5} should be plotted on the domain [-1.5,2.5]. It is only plotted on the domain [1,2.5].

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\noindent \hspace*{\fill}
\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,unit vector ratio={2 1},clip=false,
axis lines=middle,
xmin=-1.5,xmax=2.5,
domain=-1.5:2.5, samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-1,ymax=3,
restrict y to domain=-1:3,
%enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
extra x ticks={0.83333, 1, 1.6666},
extra x tick labels={$\frac{5}{6}$, $1$, $\frac{5}{3}$},
extra y ticks={-2},
extra y tick labels={$ma+b$},
yticklabel style={anchor=west},
yticklabel shift=-4pt,
ticklabel style={font=\tiny,fill=white},
xtick={0.83333, 1, 1.6666},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\end{axis}
\end{tikzpicture}
\hspace{\fill}
\vskip0.2in

\end{document}

• Why do you persistently tag these as TikZ questions? Oct 28, 2014 at 15:07
• @percusse. I am not sure what you are referring to as "these." This is a TikZ question. Oct 28, 2014 at 15:11
• x^0.2 is complex for x<0. PGFPlots doesn't handle complex numbers. Perhaps you meant to plot x * abs(x-1)^2?
– Jake
Oct 28, 2014 at 15:25
• I have retagged your previous questions too, that's what I mean by these. Pgfplots uses Tikz environment but has its own habitat so searching for pgfplots questions don't include tikz tag. pgfplots is a separate tag. So we use to tag those. Oct 28, 2014 at 15:44
• @Jake I guess that x^{0.2} is interpreted as x^{1/5}, which is defined on the set of all real numbers. Anyway, pgfplots is not plotting this function at 1. The function value is 0. Oct 28, 2014 at 16:10

You can get the real root using

declare function={
realroot(\n,\x) = ((abs(\x))^(1/\n))*(\x)/abs(\x);
}


Then you get the following plot, which seems to agree with what WolframAlpha does:

\documentclass[10pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}
\begin{tikzpicture}[
declare function={
realroot(\n,\x) = ((abs(\x))^(1/\n))*(\x)/abs(\x);
}
]
\begin{axis}