pub struct Cubic {
pub c0: f64,
pub c1: f64,
pub c2: f64,
pub c3: f64,
}Fields§
§c0: f64§c1: f64§c2: f64§c3: f64Implementations§
Source§impl Cubic
impl Cubic
pub fn eval(&self, x: f64) -> f64
pub fn deriv(&self) -> Quadratic
pub fn max_coeff(&self) -> f64
pub fn root_between_with_output_error( self, lower: f64, upper: f64, y_error: f64, ) -> f64
pub fn root_between(self, lower: f64, upper: f64, x_error: f64) -> f64
pub fn all_roots(self, lower: f64, upper: f64, x_error: f64) -> ArrayVec<f64, 3>
pub fn all_roots_with_output_error( self, lower: f64, upper: f64, y_error: f64, ) -> ArrayVec<f64, 3>
Sourcepub fn roots_between_with_output_error(
self,
lower: f64,
upper: f64,
y_error: f64,
) -> ArrayVec<f64, 3>
pub fn roots_between_with_output_error( self, lower: f64, upper: f64, y_error: f64, ) -> ArrayVec<f64, 3>
Computes all roots between lower and upper, to the desired accuracy.
“Accuracy” is measured with respect to the cubic’s value: if this cubic
is called f and we find some x with |f(x)| < accuracy (and x is
contained between two endpoints where f has opposite signs) then we’ll
call x a root.
We make no guarantees about multiplicity. In fact, if there’s a double-root that isn’t a triple-root (and therefore has no sign change nearby) then there’s a good chance we miss it altogether. This is fine if you’re using this root-finding to optimize a quartic, because double-roots of the derivative aren’t local extrema.
pub fn roots_blinn(&self) -> ArrayVec<f64, 3>
Trait Implementations§
impl Copy for Cubic
Auto Trait Implementations§
impl Freeze for Cubic
impl RefUnwindSafe for Cubic
impl Send for Cubic
impl Sync for Cubic
impl Unpin for Cubic
impl UnwindSafe for Cubic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more