This is my effort for plotting w-lambert and its inverse, but I get an error:
\begin{figure}[t]
\centering
\begin{subfigure}[scale = 1]{0.4\textwidth}
% \includegraphics[width=\textwidth]{lambert_a.jpg}
\begin{tikzpicture}
\begin{axis}[
samples=1001,
enlarge x limits=false,
axis lines=middle,
xmin=-3.1,
ymax=1.4,
ytick={-1, 1},
xtick={-3,-2,-1, 1, 2},
yticklabels={{$-1$}, {$1$}},
yticklabel pos=right,
width=10cm,
xlabel = \(x\),
xlabel style={xshift=0.5cm, yshift=-0.2cm},
every y tick label/.style={
anchor=near yticklabel opposite,
xshift=0.2em,
},
ylabel = \(y(x)\),
ylabel style={xshift=-0.5cm, yshift=0.6cm},
]
% \addplot [red!80!black, domain=-4.2:-1, line width=0.3mm, dashed] (x * exp(x), x);
\addplot [green!60!black, domain=-3:1.1, line width=0.5mm] (x, x * exp(x));
%
\draw[dotted] (-1,-0.367879441171442321595523770161460867445811131031767834507836801) --
(0, -0.367879441171442321595523770161460867445811131031767834507836801);
\node[right] at (0, -0.4){\normalsize{$-1/e$}};
\end{axis}
\end{tikzpicture}
\caption{
$y=x e^{x}$}
\label{fig:first}
\end{subfigure}
\hfill
\begin{subfigure}[scale =1]{0.4\textwidth}
% \includegraphics[width=\textwidth]{lambert_b.jpg}
\begin{tikzpicture}[scale=1,thick]
\begin{axis}[
samples=1001,
enlarge y limits=false,
axis lines=middle,
xmin=-1.1,
ymax=1.4,
ytick={-4, -3, -2, -1, 1},
xtick={-1, 1, 2, 3},
yticklabels={{$-4$}, {$-3$}, {$-2$}, {$-1$}, {$1$}},
yticklabel pos=right,
width=10cm,
xlabel = \(x\),
xlabel style={xshift=0.5cm, yshift=-0.2cm},
every y tick label/.style={
anchor=near yticklabel opposite,
xshift=0.2em,
},
ylabel = \(W(x)\),
ylabel style={xshift=-0.5cm, yshift=0.6cm},
]
\addplot [red!80!black, domain=-4.2:-1, line width=0.3mm, dashed] (x * exp(x), x);
\addplot [blue!80!black, domain=-1:1.1, line width=0.3mm] (x * exp(x), x);
\draw[dotted] (-0.367879441171442321595523770161460867445811131031767834507836801,-1) -- (-0.367879441171442321595523770161460867445811131031767834507836801, 0);
\node[above] at (-0.4, 0){\tiny{$-1/e$}};
\end{axis}
\end{tikzpicture}
\caption{
$W(x),\quad x \geq \frac{-1}{e}$
}
\label{fig:second}
\end{subfigure}
\caption{
$W(x)$
and
its inverse
}
\label{fig:figures}
\end{figure}
\end{definition}
``´
y=x*exp(x)
that can be plotted with\draw plot[domain=-2:2] (\x,{\x*exp(\x)});