productlog

constexpr Complex productlog(const Complex &z) noexcept

Evaluates the Lambert W function [1] for a complex input.

Parameters

const Complex &z

A complex number.

Returns

type Complex

A complex number.

The Lambert W function is defined as the inverse of the following function:

\[f(z) = ze^z\]

For \(w = W(z)\), where \(W(z)\) is the Lambert W function, then it holds that:

\[\begin{split}\begin{flalign} z &= we^w \\ 0 &= we^w - z \end{flalign}\end{split}\]

Thus a numerical approximation of the Lambert W function can be found by using Newton’s method [2] to root-find the above equation.

Example

Complex z = 1.0 + 1_j;
std::cout << productlog(z) << "\n";

Output:

0.656966 + 0.32545j

References