lambertW.RdComputes the Lambert W function for real values.
lambertW(x, tolerance = 1e-10, maxit = 50)The Lambert \(W\) function is the root of the equation \(W(z) \exp(W(z)) = z\) for complex \(z\). If \(z\) is real and \(-1/e < z < 0\) then it has two possible real values, and currently only the upper branch (often called \(W_0\)) is computed so that a value that is \(\geq -1\) is returned.
This function returns the principal branch of the \(W\) function
for real \(z\).
It returns \(W(z) \geq -1\),
and NA for \(z < -1/e\).
Corless, R. M. and Gonnet, G. H. and Hare, D. E. G. and Jeffrey, D. J. and Knuth, D. E. (1996). On the Lambert \(W\) function. Advances in Computational Mathematics, 5(4), 329–359.
If convergence does not occur then increase the value of
maxit and/or tolerance.
Yet to do: add an argument lbranch = TRUE to return
the lower branch
(often called \(W_{-1}\))
for real \(-1/e \leq z < 0\);
this would give \(W(z) \leq -1\).