1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! boost/math/special_functions/lambert_w.hpp
use crate::ffi;
/// Lambert W function for the principal branch *k=0*
///
/// See [`lambert_wm1`] for principal branch *k=-1*.
///
/// Corresponds to `boost::math::lambert_w0` in C++.
/// <https://boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/lambert_w.html>
///
/// # Examples
///
/// ```
/// # use approx::assert_relative_eq;
/// # use boost::math::lambert_w0;
/// let x = 1.0;
/// let w = lambert_w0(x);
/// println!("w = {w}");
/// assert_relative_eq!(w * w.exp(), x);
/// ```
pub fn lambert_w0(x: f64) -> f64 {
unsafe { ffi::math_lambert_w0(x) }
}
/// Derivative of [`lambert_w0`]
///
/// Corresponds to `boost::math::lambert_w0_prime` in C++.
/// <https://boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/lambert_w.html>
pub fn lambert_w0_prime(x: f64) -> f64 {
unsafe { ffi::math_lambert_w0_prime(x) }
}
/// Lambert W function for the principal branch *k=-1*
///
/// See [`lambert_w0`] for principal branch *k=0*.
///
/// Corresponds to `boost::math::lambert_wm1` in C++.
/// <https://boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/lambert_w.html>
///
/// # Examples
///
/// ```
/// # use approx::assert_relative_eq;
/// # use boost::math::lambert_wm1;
/// let x = -0.2;
/// let w = lambert_wm1(x);
/// println!("w = {w}");
/// assert_relative_eq!(w * w.exp(), x);
/// ```
pub fn lambert_wm1(x: f64) -> f64 {
unsafe { ffi::math_lambert_wm1(x) }
}
/// Derivative of [`lambert_wm1`]
///
/// Corresponds to `boost::math::lambert_wm1_prime` in C++.
/// <https://boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/lambert_w.html>
pub fn lambert_wm1_prime(x: f64) -> f64 {
unsafe { ffi::math_lambert_wm1_prime(x) }
}