numquad

Crates.ionumquad
lib.rsnumquad
version0.1.3
created_at2025-07-01 09:51:24.70035+00
updated_at2025-08-26 07:32:37.286734+00
descriptionNumerical integration quadratures like Gauss-Legendre and Tanh-Sinh
homepage
repositoryhttps://github.com/TileHalo/numquad
max_upload_size
id1732998
size108,634
Leo Lahti (TileHalo)

documentation

README

Numerical quadrature rules (Numquad) build status

Numquad provides various numerical integration algorithms for use.

Usage

Add the following under [dependencies] in your cargo.toml

numquad = 0.1

To use for example the Michalski-Mosig variant of $\tanh\sinh$ quadrature include the following:

use numquad::{Integral, quadrature::{TanhSinh}};
...

let integrator = TanhSinh::new();
let func = |x: f64| f64::powi(x, 2);

let result = integrator.integrate(func, Some(0), Some(1)); // Ok(0.3333...)

WARNING: This project is in early stages and until 1.0.0 subject to breaking chances etc.

Use cases

This crate can be used to integrate integrals in the form $\int_a^b f(x) dx$ where $a, b \in \R$ and $f: \R \to B \subset \C$, semi-infinite integrals where either $a$ or $b$ is infinite and infinite intervals (both are infinite). Furthermore, integration on certain simplicies (triangle, quadrilateral, tetrahedrons, and hexahedrons) is supported.

Currently used and planned quadratures are:

  • Trapezoidal rule

  • Gaussian quadratures

    • Gauss-Legendre
    • Gauss-Jacobi
    • Chebyshev-Gauss
    • Gauss-Laguerre
    • Gauss-Hermite
  • Gauss-Legendre

    • Real line
    • Triangle
    • Quadrilateral
    • Tetrahedron
    • Hexahedron
  • Michalski-Mosig $\tanh\sinh$

  • Michalski-Mosig $\exp\sinh$ (semi-infinite interval)

  • Michalski-Mosig $\sinh\sinh$ (infinite interval)

Contributing

Feel free to submit bug reports, feature requests, and the best of all, pull requests to those issues.

Commit count: 18

cargo fmt