Your "problem" was that you didn't show the axis tick labels when plotting. If you would have done this, you would have noticed that the lower bound is -2 and thus giving a lower domain value of -3 doesn't make really sense. So just changing this to -2 is enough to solve your problem. Then you can play with the number of samples to get the proper "smoothness".
But you could also use non-linear spacing to plot that function with the default number of samples being 25 to get an almost identical result, especially when you use the factorized version of that function that already was stated by Ruixi Zhang in the comment below the question.
If you think that is not good enough you could play with the "non-linearity factor" a or with the number of samples.
Hopefully this and the comments in the code are enough so you understand what's going on.
% used PGFPlots v1.17
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{
% use this `compat` level or higher to make use of Lua computation engine
compat=1.12,
% (only used for proper displaying. The `cycle list` is from the `colorbrewer` library)
cycle list/Dark2,
cycle multiindex* list={
[1 of]mark list\nextlist
Dark2\nextlist
},
}
\begin{document}
\begin{tikzpicture}[
% declare functions
declare function={
% function to plot
% f(\x) = sqrt(\x^3 - 3*\x + 2);
% can be rewritten (as stated by Ruixi Zhang) as
f(\x) = (\x-1)*sqrt(\x+2);
% state lower and upper boundaries
lb = -2;
ub = 3;
% -----------------------------------------------------------------
%%% non-linear spacing:
%%% adapted from <https://tex.stackexchange.com/a/443731/95441>
% "non-linearity factor"
a = 1;
% function to use for the nonlinear spacing
Y(\x) = exp(a*\x);
% rescale to former limits
X(\x) = (Y(\x) - Y(lb))/(Y(ub) - Y(lb)) * (ub - lb) + lb;
},
]
% -------------------------------------------------------------------------
\begin{axis}[
xmin=-3,
xmax=3,
ymin=-3,
ymax=3,
axis lines=middle,
smooth,
axis equal image=true,
% adjusted to proper limits
% (as variables given above)
domain=lb:ub,
mark size=1pt,
]
% ("usual" attempt only corrected for the lower domain bound)
\addplot+ [samples=201,no markers,thick] { sqrt(\x^3 - 3*\x + 2)};
\addplot+ [samples=201,no markers,thick] {-sqrt(\x^3 - 3*\x + 2)};
% here plotting with 25 points with non-linear spacing
\addplot+ ({X(x)}, { f(X(x))});
% \addplot+ [no markers]({X(x)}, {-f(X(x))});
\end{axis};
\end{tikzpicture}
\end{document}

samples=301. Alternatively, you could do another plot on top over a smaller domain. For instance if you also include\addplot [thick, domain=-3:0] {sqrt(x^3-3*x+2) };and\addplot [thick, domain=-3:0] {-sqrt(x^3-3*x+2) };you get the desired plot. This is hackish, but the problem comes down to sampling at the correct points. Or, better still use a parameterized plot. – Peter Grill Jan 08 '21 at 18:52x^3-3*x+2=(x-1)^2*(x+2), we see thaty=(+/-)sqrt(x^3-3*x+2)is essentially justy=(+/-)(x-1)*sqrt(x+2). This means that there is no reason to havedomain=-3:0. Instead,domain=-2:0should be enough. – Ruixi Zhang Jan 08 '21 at 19:41