Crates.io | wright_omega |
lib.rs | wright_omega |
version | 0.1.1 |
source | src |
created_at | 2023-09-21 16:34:31.880391 |
updated_at | 2023-09-21 16:35:39.488719 |
description | A Rust implementation of the Wright Omega function |
homepage | |
repository | https://github.com/tectin0/wrightomega-rs |
max_upload_size | |
id | 979650 |
size | 15,120 |
This library is a rewrite of the wright.c
file from Lawrence, Corless, and Jeffrey [1] in rust.
The Wright Omega function is defined as the solution to the equation ω + log(ω) = z
. It is a special case of the Lambert W function.
The library is available on crates.io and can be included in your project by adding the following to your Cargo.toml
file:
[dependencies]
wright_omega = "0.1.0"
use wright_omega::wright_omega;
use wright_omega::Complex;
fn main() {
let z = Complex::new(0.0, 0.0);
let omega = wright_omega(z);
println!("Wright Omega of {} is {}", z, omega);
}
> Wright Omega of 0+0i is 0.5671433+0i
The library supports both f32
and f64
types. The f32
feature is enabled by default. To use f64
instead, add the following to your Cargo.toml
file:
[dependencies]
wright_omega = { version = "0.1.0", features = ["f64"] }
Scipy uses the same implementation for Python. Matlab also has a built in implementation.
[1] Lawrence, Corless, and Jeffrey, “Algorithm 917: Complex Double-Precision Evaluation of the Wright Function.” ACM Transactions on Mathematical Software, 2012. DOI:10.1145/2168773.2168779.