Skip to main content

AdaptiveGL7K15IntegrationEngine

Struct AdaptiveGL7K15IntegrationEngine 

Source
pub struct AdaptiveGL7K15IntegrationEngine {
    pub max_subintervals: usize,
    /* private fields */
}
Expand description

Globally adaptive Gauss-Kronrod quadrature (the strategy of QUADPACK’s qag with its 15-point rule): the interval with the largest error estimate is bisected until the estimates sum to less than the tolerance.

Each panel is integrated with the 15-point Kronrod rule, which contains the 7-point Gauss rule; their difference, calibrated as in QUADPACK, estimates the error of the (far more accurate) Kronrod value. The rule is exact for polynomials of degree 23 on each panel, so smooth integrands need very few panels, while kinks, peaks and integrable endpoint singularities draw the bisections towards themselves.

The tolerance is absolute, raised if necessary to the rounding-error level 50 ε ∫|f|; integrate fails if it cannot be met within max_subintervals panels, and integrate_with_error returns the estimate either way.

Fields§

§max_subintervals: usize

The largest number of panels (default 1000).

Implementations§

Source§

impl AdaptiveGL7K15IntegrationEngine

Source

pub fn new(tolerance: f64, lower_bound: f64, upper_bound: f64) -> Self

An engine on [lower_bound, upper_bound] aiming for an absolute error below tolerance.

Source

pub fn set_tolerance(&mut self, x: f64)

Changes the error tolerance.

Source

pub fn integrate_with_error<F: Fn(f64) -> f64>( &self, f: F, ) -> Result<(f64, f64, usize), ErrorsJSL>

The integral, its error estimate and the number of evaluations of f. The estimate may exceed the tolerance if max_subintervals was reached; a non-finite sample is an error.

Trait Implementations§

Source§

impl CanIntegrate1D for AdaptiveGL7K15IntegrationEngine

Source§

fn integrate<F>(&self, f: F) -> Result<f64, ErrorsJSL>
where F: Fn(f64) -> f64,

Approximates ∫ₐᵇ f(x) dx.
Source§

fn set_lower_bound(&mut self, x: f64)

Sets the lower bound a.
Source§

fn set_upper_bound(&mut self, x: f64)

Sets the upper bound b.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.