Trait PolynomialSeries

Source
pub trait PolynomialSeries<E: PartialOrd + Scalar<Real = E>>: Clone + Sized {
    // Required methods
    fn roots(&self) -> Result<Vec<E>, ChebyshevError>;
    fn evaluate(&self, t: E) -> E;
    fn first_derivative(&self) -> Self;
    fn degree(&self) -> usize;
    fn domain(&self) -> Range<E>;
    fn null(domain: Range<E>) -> Self;

    // Provided methods
    fn derivative(&self, count: usize) -> Self { ... }
    fn roots_in_window(&self, window: Range<E>) -> Result<bool, ChebyshevError> { ... }
    fn evaluate_unscaled(&self, x: E) -> E { ... }
    fn number_of_coefficients(&self) -> usize { ... }
    fn is_monotonic(&self) -> Result<bool, ChebyshevError> { ... }
}
Expand description

All the necessary methods for a polynomial series

Required Methods§

Source

fn roots(&self) -> Result<Vec<E>, ChebyshevError>

Finds all roots of the polynomial

§Errors
  • If there is an error building the companion matrix
Source

fn evaluate(&self, t: E) -> E

Evaluate the polynomial using an input value t which is scaled to the domain of the polynomial.

Polynomials are scaled to the domain [-1, +1]. The true unscaled limits [a, b] are stored on creation based on the input calibration data. This function evaluates the polynomial assuming the input value t has already been rescaled from [a, b] to [-1,1]

Source

fn first_derivative(&self) -> Self

Take a single order derivative of the polynomial series

Source

fn degree(&self) -> usize

Returns the degree of the polynomial

Source

fn domain(&self) -> Range<E>

The domain is the physical range of independent values used to create the polynomial.

Source

fn null(domain: Range<E>) -> Self

Returns the null polynomial, which is the zero-polynomial defined on the same range and window as the original

Provided Methods§

Source

fn derivative(&self, count: usize) -> Self

Calculate the count order derivative of the polynomial

Source

fn roots_in_window(&self, window: Range<E>) -> Result<bool, ChebyshevError>

Finds all roots of the polynomial which lie in window

§Errors
  • If there is an error building the companion matrix
Source

fn evaluate_unscaled(&self, x: E) -> E

Evaluate the polynomial using the true input value x

Polynomials are scaled to the domain [-1, +1]. The true unscaled limits [a, b] are stored on creation based on the input calibration data. This function evaluates the polynomial assuming the input value x is in [a, b], rescaling it to [-1, +1] before calling the internal evaluation method

Source

fn number_of_coefficients(&self) -> usize

The number of independent coefficients of the polynomial, which is the degree of the polynomial plus one for the scalar offset

Source

fn is_monotonic(&self) -> Result<bool, ChebyshevError>

Returns true if the polynomial is monotonic

The monotonicity of the polynomial can be checked by analysis of the first derivative. If the first derivative has no roots in the domain of the polynomial, then the polynomial is monotonic, and if not it is.

§Errors
  • If there is an error calculating the roots of the polynomial, or building the companion matrix

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§