[−][src]Module gkquad::single
Performs 1-dimentional numerical integration
Examples
In order to calculate the simple integral, you can use integral
function.
use gkquad::single::integral; // calculate the integral over range (0.0, 1.0) let result = integral(|x: f64| x.sin() * (- x * x).exp(), 0.0..1.0) .estimate() .unwrap();
If you want to calculate more complicated integral, you can use Integrator
object.
use core::f64::{INFINITY, NEG_INFINITY}; use gkquad::single::Integrator; use gkquad::single::algorithm::QAGP; // calculate the integral over range (-∞, ∞), with QAGP algorithm, // maximum iteration limit being 100, singular point on the origin of coordinate. let result = Integrator::new(|x: f64| 1. - (-(x.abs() / 1.6).powf(-2.3)).exp()) .max_iters(100) .points(&[0.]) .run(NEG_INFINITY..INFINITY) .estimate() .unwrap();
Modules
algorithm | Algorithms for 1-dimentional numerical integration |
Structs
IntegrationConfig | Integration configuration |
Integrator | Integration Executor |
QKResult | holds the result of Gauss-Kronrod integration |
Range | Represent the range for which the integral is estimated. |
Traits
Integrand | The function that is to be integrated |
Functions
integral | Performs integration using |
integral_with_config | Performs the integration with custom configuration. |
qk17 | Performs Gauss-Kronrod integration with 17-point kronrod rule |
qk25 | Performs Gauss-Kronrod integration with 25-point kronrod rule |
qk33 | Performs Gauss-Kronrod integration with 33-point kronrod rule |
qk41 | Performs Gauss-Kronrod integration with 41-point kronrod rule |
qk49 | Performs Gauss-Kronrod integration with 49-point kronrod rule |
qk57 | Performs Gauss-Kronrod integration with 57-point kronrod rule |
Type Definitions
Points | Singular points |