| lambertW {VGAM} | R Documentation |
Computes the Lambert W function for real values.
lambertW(x, tolerance = 1e-10, maxit = 50)
x |
A vector of reals. |
tolerance |
Accuracy desired. |
maxit |
Maximum number of iterations of third-order Halley's method. |
The Lambert W function is the root of the equation W(z) * exp(W(z)) = z for complex z. It is multi-valued if z is real and z < -1/e. For real -1/e <= z < 0 it has two possible real values, and currently only the upper branch is computed.
This function returns the principal branch of the W function
for real z.
It returns W(z) >= -1,
and NA for z < -1/e.
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 for
real -1/e <= z < 0;
this would give W(z) <= -1.
T. W. Yee
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.
## Not run:
curve(lambertW, -exp(-1), 3, xlim = c(-1, 3), ylim = c(-2, 1),
las = 1, col = "orange")
abline(v = -exp(-1), h = -1, lwd = 2, lty = "dotted", col = "gray")
abline(h = 0, v = 0, lty = "dashed", col = "blue")
## End(Not run)