←back to thread

126 points mtantaoui | 1 comments | | HN request time: 0.261s | source

Integrate is a fast, small, lightweight Rust library for performing numerical integration of real-valued functions. It is designed to integrate functions, providing a simple and efficient way to approximate definite integrals using various numerical methods.

Integrate supports a variety of numerical integration techniques: - Newton-Cotes methods:

  - Rectangle Rule.
  - Trapezoidal Rule.
  - Simpson's Rule.
  - Newton's 3/8 Rule.
- Gauss quadrature methods:

  - Gauss-Legendre.
  - Gauss-Laguerre.
  - Gauss-Hermite.
  - Gauss-Chebyshev First Kind.
  - Gauss-Chebyshev Second Kind.
- Adaptive Methods:

  - Adaptive Simpson's method
- Romberg’s method.
Show context
JanisErdmanis ◴[] No.42183942[source]
It looks a bit sloppy to hardcode so many constants in a single file: `src/gauss_quadrature/legendre.rs`. Isn't it possible to generate them with the help of rust macros in the same way Julia uses metaprogramming?
replies(3): >>42184353 #>>42185117 #>>42185548 #
ok123456 ◴[] No.42184353[source]
Gaussian quadrature points are typically solved numerically. There's a good chance these ultimately came from a table.

Additionally, compile time floating-point evaluation is limited. When I looked around recently, I didn't see a rust equivalent of gcem; any kind of transcendental function evaluation (which finding Gaussian quadrature points absolutely would require) would not allow compile-time evaluation.

replies(2): >>42185264 #>>42186782 #
AlotOfReading ◴[] No.42185264[source]
Support for float const fns was merged just a couple months ago and hasn't been officially announced yet.
replies(2): >>42185347 #>>42185528 #
1. BD103 ◴[] No.42185528[source]
Support for constant float operations was released in Rust 1.82! https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html