#numerical #science

spfunc

Rust crate for numerical calculation of special functions

3 releases

0.1.3 Aug 7, 2025
0.1.1 Jul 11, 2025
0.1.0 Apr 10, 2021

#480 in Math

Download history 242/week @ 2025-08-15 270/week @ 2025-08-22 376/week @ 2025-08-29 273/week @ 2025-09-05 223/week @ 2025-09-12 138/week @ 2025-09-19 191/week @ 2025-09-26 133/week @ 2025-10-03 72/week @ 2025-10-10 157/week @ 2025-10-17 256/week @ 2025-10-24 237/week @ 2025-10-31 379/week @ 2025-11-07 305/week @ 2025-11-14 339/week @ 2025-11-21 249/week @ 2025-11-28

1,341 downloads per month
Used in alpha_stable

MIT license

58KB
404 lines

spfunc

Rust crate for numerical calculation of special functions.

docs.rs

This crate can calculate each special function for f32, f64, Complex32, Complex64 (from num_complex crate).

Note

This crate is still in the development stage and the numerical calculations are not so accurate (especially Hurwitz zeta function).

Functions

The Gamma Function

  • The gamma function
  • The digamma function
  • The polygamma function

The Zeta Function

  • The Riemann zeta function
  • The Hurwitz zeta function

How to use

use spfunc::gamma::*;
use cauchy::{c32, c64};

fn main() {
    println!("Gamma(1.0) = {}", gamma(1.0));
    println!("ln(Gamma(1.0)) = {}", gamma_ln(1.0));

    println!("Gamma(1.2+3.4i) = {}", gamma(c32::new(1.2, 3.4)));
    println!("ln(Gamma(1.2+3.4i)) = {}", gamma_ln(c32::new(1.2, 3.4)));
    
    println!("DiGamma(1.2+3.4i) = {}", digamma(c64::new(1.2, 3.4)));
    println!("TriGamma(1.2+3.4i) = {}", polygamma(c64::new(1.2, 3.4), 1))
}

Dependencies

~0.7–1.1MB
~22K SLoC