From fdce39ae19c45372e06742fda3c965983ac066d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= Date: Mon, 29 Jul 2024 10:47:15 +0200 Subject: [PATCH] Use W(1)=Omega as an example instead of pi --- CHANGELOG.md | 4 ++++ README.md | 12 +++++------- src/lib.rs | 12 +++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07b5d3f..b4eb616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.5 + + - Correct the domain bounds in the function documentation strings. + ## 0.2.2, 0.2.3, and 0.2.4 - Documentation improvements. diff --git a/README.md b/README.md index c87790f..90cdc5d 100644 --- a/README.md +++ b/README.md @@ -11,28 +11,26 @@ This method uses a piecewise minimax rational function approximation. ## Examples -Evaluate the principal branch of the Lambert W function to 50 bits of accuracy: +Evaluate the Omega constant with the principal branch of the Lambert W function to 50 bits of accuracy: ```rust use lambert_w::accurate::lambert_w_0; -use core::f64::consts::PI; use approx::assert_abs_diff_eq; -let w = lambert_w_0(PI).unwrap(); +let w = lambert_w_0(1.0).unwrap(); -assert_abs_diff_eq!(w, 1.0736581947961492); +assert_abs_diff_eq!(w, 0.5671432904097838); ``` or to only 24 bits of accuracy, but with faster execution time: ```rust use lambert_w::fast::lambert_w_0; -use core::f64::consts::PI; use approx::assert_abs_diff_eq; -let w = lambert_w_0(PI).unwrap(); +let w = lambert_w_0(1.0).unwrap(); -assert_abs_diff_eq!(w, 1.0736581947961492, epsilon = 1e-7); +assert_abs_diff_eq!(w, 0.5671432904097838, epsilon = 1e-7); ``` ## Speed-accuracy trade-off diff --git a/src/lib.rs b/src/lib.rs index 55a9325..2e64f48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,19 +6,18 @@ //! //! ## Examples //! -//! Evaluate the principal branch of the Lambert W function to 50 bits of accuracy: +//! Evaluate the omega constant with the principal branch of the Lambert W function to 50 bits of accuracy: #![cfg_attr( feature = "50bits", doc = r##" ``` use lambert_w::accurate::lambert_w_0; -use core::f64::consts::PI; use approx::assert_abs_diff_eq; -let w = lambert_w_0(PI).unwrap(); +let w = lambert_w_0(1.0).unwrap(); -assert_abs_diff_eq!(w, 1.0736581947961492); +assert_abs_diff_eq!(w, 0.5671432904097838); ``` "## )] @@ -30,12 +29,11 @@ assert_abs_diff_eq!(w, 1.0736581947961492); ``` use lambert_w::fast::lambert_w_0; -use core::f64::consts::PI; use approx::assert_abs_diff_eq; -let w = lambert_w_0(PI).unwrap(); +let w = lambert_w_0(1.0).unwrap(); -assert_abs_diff_eq!(w, 1.0736581947961492, epsilon = 1e-7); +assert_abs_diff_eq!(w, 0.5671432904097838, epsilon = 1e-7); ``` "## )]