Crates.io | integrate |
lib.rs | integrate |
version | 0.1.4 |
source | src |
created_at | 2024-10-21 08:45:40.391053 |
updated_at | 2024-10-21 12:37:01.303567 |
description | Small, lightweight Rust library for performing numerical integration. |
homepage | |
repository | https://github.com/mtantaoui/Integrate |
max_upload_size | |
id | 1417114 |
size | 368,241 |
Integrate is a 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.
Numerical integration is concerned with developing algorithms to approximate the integral of a function $f(x)$. The most commonly used algorithms are Newton-Cotes formulas, Romberg's method, Gaussian quadrature, and to lesser extents Hermite's formulas and certain adaptive techniques.
Integrate supports a variety of numerical integration techniques:
Newton-Cotes methods:
Gauss quadrature methods:
Adaptive Methods:
Romberg’s method.
All of the numerical integration techniques listed above assume that the integrand is continuous on the interval of integration. The error estimates generally require that the integrands are differentiable of whatever order is required so that the formula for the error estimate makes sense. Below is a check list which one should verify before using any of the numerical algorithms.
Are there any singularities of the integrand in the interval of integration?
If there are, then can they be removed?
A function which has jump discontinuities can be integrated by splitting the interval of integration into subintervals on which the function is continuous, and then numerically integrate over each subinterval and add the results.
Using integration by parts certain types of singular integrals can be expressed as the sum of a function and a non-singular integral.
In other cases, an approximation of the integral in a small neighborhood of the singularity can be obtained by hand and the interval of integration can be split into three intervals in which numerical integration can be used on two of them.
Does the function oscillate over the region of integration? If it does, then make sure that the step size is chosen to be smaller than the wave length of the function. The interval of integration can also be split into subintervals in which each subinterval is half a wave length and the algorithm is applied to each subinterval.
To use the Integrate
crate in your Rust project, add the following line to your Cargo.toml
:
[dependencies]
integrate = "0.1.0"
Feel free to submit issues or pull requests for bug fixes, new features, or other improvements. Contributions are welcome!
This project is licensed under the MIT License – see the LICENSE file for details. Opening a pull request is assumed to signal agreement with these licensing terms.