lambertW {VGAM} | R Documentation |
The Lambert W Function
Description
Computes the Lambert W function for real values.
Usage
lambertW(x, tolerance = 1e-10, maxit = 50)
Arguments
x |
A vector of reals. |
tolerance |
Accuracy desired. |
maxit |
Maximum number of iterations of third-order Halley's method. |
Details
The Lambert function is the root of the equation
for complex
.
If
is real and
then
it has two possible real values,
and currently only the upper branch
(often called
)
is computed so that
a value that is
is returned.
Value
This function returns the principal branch of the function
for real
.
It returns
,
and
NA
for .
Note
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 )
for real
;
this would give
.
Author(s)
T. W. Yee
References
Corless, R. M. and Gonnet, G. H. and
Hare, D. E. G. and Jeffrey, D. J. and Knuth, D. E. (1996).
On the Lambert function.
Advances in Computational Mathematics,
5(4), 329–359.
See Also
log
,
exp
,
bell
.
There is also a package called LambertW.
Examples
## Not run:
curve(lambertW, -exp(-1), 3, xlim = c(-1, 3), ylim = c(-2, 1),
las = 1, col = "orange", n = 1001)
abline(v = -exp(-1), h = -1, lwd = 2, lty = "dotted", col = "gray")
abline(h = 0, v = 0, lty = "dashed", col = "blue")
## End(Not run)