| Crates.io | mittagleffler |
| lib.rs | mittagleffler |
| version | 0.1.4 |
| created_at | 2025-01-04 13:39:17.824788+00 |
| updated_at | 2025-06-17 18:27:34.895535+00 |
| description | High performance implementations of the Mittag-Leffler function |
| homepage | https://github.com/alexfikl/mittagleffler |
| repository | |
| max_upload_size | |
| id | 1503900 |
| size | 142,694 |

This library implements the two-parameter Mittag-Leffler function.
Currently only the algorithm described in the paper by Roberto Garrapa (2015) is implemented. This seems to be the most accurate and computationally efficient method to date for evaluating the Mittag-Leffler function.
Links
LICENSES/MIT.txt).Other implementations
The library is available as a Rust crate that implements the main algorithms. Evaluating the Mittag-Leffler function can be performed directly by
use mittagleffler::MittagLeffler;
let alpha = 0.75;
let beta = 1.25;
let z = Complex64::new(1.0, 2.0);
println!("E({}; {}, {}) = {}", z, alpha, beta, z.mittag_leffler(alpha, beta));
let z: f64 = 3.1415;
println!("E({}; {}, {}) = {}", z, alpha, beta, z.mittag_leffler(alpha, beta));
This method will call the best underlying algorithm and takes care of any special
cases that are known in the literature, e.g. for (alpha, beta) = (1, 1) we
know that the Mittag-Leffler function is equivalent to the standard exponential.
To call a specific algorithm, we can do
use mittagleffler::GarrappaMittagLeffler
let eps = 1.0e-8;
let ml = GarrappaMittagLeffler::new(eps);
let z = Complex64::new(1.0, 2.0);
println!("E({}; {}, {}) = {}",z, alpha, beta, ml.evaluate(z, alpha, beta));
The algorithm from Garrappa (2015) has several parameters that can be tweaked for better performance or accuracy. They can be found in the documentation of the structure, but should not be changed unless there is good reason!
The library also has Python bindings (using pyo3)
that can be found in the python directory. The bindings are written to work
with scalars and with numpy arrays equally. For example
import numpy as np
from pymittagleffler import mittag_leffler
alpha, beta = 2.0, 2.0
z = np.linspace(0.0, 1.0, 128)
result = mittag_leffler(z, alpha, beta)
These are available on PyPI under the name pymittagleffler.