Title: | Lambert-W Function |
---|---|
Description: | Implements both real-valued branches of the Lambert-W function (Corless et al, 1996) <doi:10.1007/BF02124750> without the need for installing the entire GSL. |
Authors: | Avraham Adler [aut, cph, cre] |
Maintainer: | Avraham Adler <[email protected]> |
License: | BSD_2_clause + file LICENSE |
Version: | 2.2.4 |
Built: | 2024-11-13 05:14:20 UTC |
Source: | https://github.com/aadler/lamw |
Implements both real-valued branches of the Lambert-W function (Corless et al, 1996) <doi:10.1007/BF02124750> without the need for installing the entire GSL.
The DESCRIPTION file:
Package: | lamW |
Type: | Package |
Title: | Lambert-W Function |
Version: | 2.2.4 |
Date: | 2024-06-16 |
Authors@R: | c(person(given="Avraham", family="Adler",role=c("aut", "cph", "cre"), email="[email protected]", comment = c(ORCID = "0000-0002-3039-0703"))) |
Description: | Implements both real-valued branches of the Lambert-W function (Corless et al, 1996) <doi:10.1007/BF02124750> without the need for installing the entire GSL. |
License: | BSD_2_clause + file LICENSE |
Imports: | Rcpp, RcppParallel |
LinkingTo: | Rcpp, RcppParallel |
SystemRequirements: | GNU make |
Suggests: | covr, tinytest, methods |
NeedsCompilation: | yes |
URL: | https://github.com/aadler/lamW |
BugReports: | https://github.com/aadler/lamW/issues |
UseLTO: | yes |
Config/pak/sysreqs: | make |
Repository: | https://aadler.r-universe.dev |
RemoteUrl: | https://github.com/aadler/lamw |
RemoteRef: | HEAD |
RemoteSha: | 1ee5753f9337c1b117def5525fd8c00e222adba9 |
Author: | Avraham Adler [aut, cph, cre] (<https://orcid.org/0000-0002-3039-0703>) |
Maintainer: | Avraham Adler <[email protected]> |
Index of help topics:
lamW-package Lambert-W Function lambertW0 Lambert-W Function
Avraham Adler [aut, cph, cre] (<https://orcid.org/0000-0002-3039-0703>) Maintainer: Avraham Adler <[email protected]>
The Lambert-W function is defined as the multivalued inverse of the function
. The function has two branches. The
principal branch is defined on the interval
and is always greater
than or equal to
. The second branch is defined on the interval
and is always less than or equal
to
. The real-valued function is not defined for values less than
.
lambertW0(x) lambertWm1(x)
lambertW0(x) lambertWm1(x)
x |
numeric vector of values |
The Lambert-W function is defined for all real
. It has two values in the interval
. The values strictly greater than
are assigned to the “principal” branch, also referred to as
, and the values strictly less than
are assigned to the
“secondary” branch, referred to as
. For non-negative
, only the principal branch exists as the other real-valued branch
approaches negative infinity as
approaches
. The algorithms used
to calculate the values predominantly follow those in the reference with some
simplifications. There are many applications in which the Lambert-W function is
useful, such as combinatorics, physics, and hydrology. The interested reader is
directed to the references for more detail.
Both functions return the appropriate values in the intervals for which they are
defined. Outside of those intervals, they will return NaN
, except that
lambertW0(Inf)
will return its limit Inf
and lambertWm1(0)
will return its limit -Inf
.
Avraham Adler [email protected]
Corless, R. M., Gonnet, G. H., Hare, D. E., Jeffrey, D. J., Knuth, D. E. 1996 "On the Lambert W function", Advances in Computational Mathematics, 5, 329–359, Springer <doi:10.1007/BF02124750>
Fritsch, F. N.; Shafer, R. E. & Crowley, W. P. 1973 "Solution of the transcendental equation (we^w = x)", Communications of the ACM, 16, 123–124, Association for Computing Machinery (ACM) <doi:10.1145/361952.361970>
This package provides similar functionality to the
Lambert
functions in the gsl package without
having to obtain or install the entire GSL.
lambertW0(exp(1)) ## Should equal 1, as 1 * exp(1) = e. lambertW0(0) ## Should equal 0, as 0 * exp(0) = 0. lambertW0(-exp(-1)) ## Should equal -1. lambertWm1(-exp(-1)) ## Should also equal -1. A <- -2 * exp(-2) lambertWm1(A) ## Should equal -2
lambertW0(exp(1)) ## Should equal 1, as 1 * exp(1) = e. lambertW0(0) ## Should equal 0, as 0 * exp(0) = 0. lambertW0(-exp(-1)) ## Should equal -1. lambertWm1(-exp(-1)) ## Should also equal -1. A <- -2 * exp(-2) lambertWm1(A) ## Should equal -2