For each integer \(k\) there exists a branch of Lambert’s \(W\) denoted \(W_k\). The principal branch is \(W_0\) and the \((-1)\) branch is \(W_{-1}\). We will generate data for the three branches \(k=-1,\:0,\:1\) in sequence.
For the real projection of values of \(W\) we chose the sum of real and imaginary parts: \(z \mapsto \Re{(W(z))} + \Im{(W(z))}\). This was not the best choice, but it conforms to the usual choice we make to draw the Riemann surface of the logarithm.
For the domain we use a polar coordinate system centered at \(z= -\frac{ 1 }{ e }\) since that point is the edge of the negative \(x\)-axis branch cut, and the Riemann surface has a natural axial-rotational structure.
We sample values at approximately \(100\) radii ranging from \(0.01\) to \(4\) and approximately \(100\) angles sweeping everything but the negative \(x\)-semiaxis. The more samples, the longer the rendering will take, and this is already very slow even with lualatex. To generate the data, we execute with SageMath
#!/usr/bin/sage
#
# Change shebang or pass to your `sage` executable according to
# your platform and installation.
= [ x/100.0 for x in range(1, 400, 4) ]
radii = [ x/100000.0 for x in range(-314159, 314159, 5000) ]
angles = [ -1, 0, 1 ]
branches
= [ [ (r*cos(t), r*sin(t), lambert_w(i, -1/e.n() + r * exp(I*t) ))
Lambert for r in radii for t in angles ] for i in branches ]
= [ [ (x, y, z.real() + z.imag())
LambertReal for (x,y,z) in Lambert[i] ] for i in branches ]
= open(f"lambert.dat", "w")
f = f.write("x y z\n")
_
for i in branches:
for (a, b, c) in LambertReal[i]:
= f.write(f"{a} {b} {c}\n") _
and put the .dat file in the latex project folder. The rendering code in the tex file is given in the following page.
% !TeX TS-program = lualatex
%
% No command line options should be needed for lualatex with an
% up-to-date installation of TeXLive. This file assumes that the
% generated `lambert.dat` file is in the same directory as this
% .tex file.
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[$W$.},
title={Part of the Riemann surface of
view={90}{10},
width=7cm,
height=10cm,
axis line style={draw=none},
ticks=none,
colormap/violet,
z buffer=sort,
]\addplot3[surf] table {lambert.dat};
\end{axis}
\end{tikzpicture}
\end{document}