Trait peroxide::numerical::integral::NCIntegrable
source · pub trait NCIntegrable: Sub<Self, Output = Self> + Sized {
type NodeY;
type NCPolynomial;
// Required methods
fn compute_node_y<F>(f: F, node_x: &[f64]) -> Self::NodeY
where F: Fn(f64) -> Self;
fn compute_polynomial(
node_x: &[f64],
node_y: &Self::NodeY,
) -> Self::NCPolynomial;
fn integrate_polynomial(p: &Self::NCPolynomial) -> Self::NCPolynomial;
fn evaluate_polynomial(p: &Self::NCPolynomial, x: f64) -> Self;
}
Expand description
Type that can be integrated using Newton Cotes Quadrature
Required Associated Types§
type NodeY
type NCPolynomial
Required Methods§
sourcefn compute_node_y<F>(f: F, node_x: &[f64]) -> Self::NodeY
fn compute_node_y<F>(f: F, node_x: &[f64]) -> Self::NodeY
Returns the image of node_x
under function f
, in a representation
(Self::NodeY
) suitable for separately computing one Lagrange polynomial
for each of the degrees of freedom of Self
(e.g. a Vec
with as many
entries as the number of degrees of freedom).
sourcefn compute_polynomial(
node_x: &[f64],
node_y: &Self::NodeY,
) -> Self::NCPolynomial
fn compute_polynomial( node_x: &[f64], node_y: &Self::NodeY, ) -> Self::NCPolynomial
Computes one Lagrange polynomial
for each one
of the degrees of freedom of Self
, returning them in a representation
(Self::NCPolynomial
) suitable to separately performing operation on
them (e.g. Vec<Polynomial>
).
sourcefn integrate_polynomial(p: &Self::NCPolynomial) -> Self::NCPolynomial
fn integrate_polynomial(p: &Self::NCPolynomial) -> Self::NCPolynomial
Separately integrates each of the polynomials obtained using
compute_polynomial
.
sourcefn evaluate_polynomial(p: &Self::NCPolynomial, x: f64) -> Self
fn evaluate_polynomial(p: &Self::NCPolynomial, x: f64) -> Self
Separately evaluates each of the polynomial integrated using
integrate_polynomial
at x
,
then recombines the result into a Self
.
Object Safety§
This trait is not object safe.