Skip to content

Commit 01917cf

Browse files
committed
implement Lambert W function
This copies the implementation of the Lambert W function and related functions and data from jlapeyre/LambertW.jl to SpecialFunctions.jl
1 parent 36c547b commit 01917cf

File tree

7 files changed

+578
-2
lines changed

7 files changed

+578
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SpecialFunctions.jl
22

33
Special mathematical functions in Julia, including Bessel, Hankel, Airy, error, Dawson, exponential (or sine and cosine) integrals,
4-
eta, zeta, digamma, inverse digamma, trigamma, and polygamma functions.
4+
eta, zeta, Lambert's W, digamma, inverse digamma, trigamma, and polygamma functions.
55
Most of these functions were formerly part of Base in early versions of Julia.
66

77
CI (Linux, macOS, FreeBSD, Windows):

docs/src/functions_list.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,7 @@ SpecialFunctions.beta
6969
SpecialFunctions.logbeta
7070
SpecialFunctions.logabsbeta
7171
SpecialFunctions.logabsbinomial
72+
SpecialFunctions.lambertw
73+
SpecialFunctions.lambertwbp
74+
SpecialFunctions.omega
7275
```

docs/src/functions_overview.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,9 @@ Here the *Special Functions* are listed according to the structure of [NIST Digi
9595
|:-------- |:----------- |
9696
| [`eta(x)`](@ref SpecialFunctions.eta) | [Dirichlet eta function](https://en.wikipedia.org/wiki/Dirichlet_eta_function) at `x` |
9797
| [`zeta(x)`](@ref SpecialFunctions.zeta) | [Riemann zeta function](https://en.wikipedia.org/wiki/Riemann_zeta_function) at `x` |
98+
99+
## [Lambert's W Function](https://dlmf.nist.gov/4.13)
100+
| Function | Description |
101+
|:-------- |:----------- |
102+
| [`lambertw(x, [k=0])`](@ref SpecialFunctions.lambertw) | [Lambert's W function](https://en.wikipedia.org/wiki/Lambert_W_function) at `x` for `k`-th branch |
103+
| [`lambertwbp(x, [k=0])`](@ref SpecialFunctions.lambertwbp) | Accurate value of ``1 + W_k(-\frac{1}{\mathrm{e}} + x)`` for small `x` |

src/SpecialFunctions.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ export
7878
expintx,
7979
sinint,
8080
cosint,
81-
lbinomial
81+
lbinomial,
82+
lambertw,
83+
lambertwbp
8284

8385
include("bessel.jl")
8486
include("erf.jl")
@@ -89,6 +91,7 @@ include("gamma.jl")
8991
include("gamma_inc.jl")
9092
include("betanc.jl")
9193
include("beta_inc.jl")
94+
include("lambertw.jl")
9295
include("chainrules.jl")
9396
include("deprecated.jl")
9497

0 commit comments

Comments
 (0)