Skip to main content

CanIntegrate1D

Trait CanIntegrate1D 

Source
pub trait CanIntegrate1D {
    // Required methods
    fn set_lower_bound(&mut self, x: f64);
    fn set_upper_bound(&mut self, x: f64);
    fn integrate<F>(&self, f: F) -> Result<f64, ErrorsJSL>
       where F: Fn(f64) -> f64;
}
Expand description

A one-dimensional quadrature rule on an interval [a, b], approximating ∫ₐᵇ f(x) dx.

Engines are configured at construction (number of points, tolerance, …); the bounds can be changed afterwards, so one engine can be reused across many integrals. See the book’s numerical integration chapter for how to choose an engine.

Required Methods§

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.

Source

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

Approximates ∫ₐᵇ f(x) dx.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§