#numerical #science

spfunc

Rust crate for numerical calculation of special functions

1 unstable release

0.1.0 Apr 10, 2021

#1559 in Math

Download history 72/week @ 2023-11-18 193/week @ 2023-11-25 78/week @ 2023-12-02 65/week @ 2023-12-09 117/week @ 2023-12-16 10/week @ 2023-12-23 7/week @ 2023-12-30 85/week @ 2024-01-06 28/week @ 2024-01-13 38/week @ 2024-01-20 62/week @ 2024-01-27 25/week @ 2024-02-03 54/week @ 2024-02-10 44/week @ 2024-02-17 33/week @ 2024-02-24 66/week @ 2024-03-02

207 downloads per month
Used in alpha_stable

MIT license

18KB
330 lines

spfunc

Rust crate for numerical calculation of special functions.

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.6–1MB
~18K SLoC