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§
Sourcefn evaluate(&self, t: E) -> E
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]
Sourcefn first_derivative(&self) -> Self
fn first_derivative(&self) -> Self
Take a single order derivative of the polynomial series
Provided Methods§
Sourcefn derivative(&self, count: usize) -> Self
fn derivative(&self, count: usize) -> Self
Calculate the count order derivative of the polynomial
Sourcefn roots_in_window(&self, window: Range<E>) -> Result<bool, ChebyshevError>
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
Sourcefn evaluate_unscaled(&self, x: E) -> E
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
Sourcefn number_of_coefficients(&self) -> usize
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
Sourcefn is_monotonic(&self) -> Result<bool, ChebyshevError>
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.