#special-functions

wright_omega

A Rust implementation of the Wright Omega function

2 releases

0.1.1 Sep 21, 2023
0.1.0 Sep 21, 2023

#1805 in Math

MIT license

14KB
192 lines

WrightOmega

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.

Usage

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"

Example

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

Features

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"] }

Other Implementations

Scipy uses the same implementation for Python. Matlab also has a built in implementation.

References

[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.


Dependencies

~270KB