[][src]Trait rustnomial::Derivable

pub trait Derivable<N> {
    pub fn derivative(&self) -> Self;
}

Required methods

pub fn derivative(&self) -> Self[src]

Loading content...

Implementors

impl<N> Derivable<N> for LinearBinomial<N> where
    N: Zero + One + Copy + Mul<Output = N> + TryFromUsizeExact, 
[src]

pub fn derivative(&self) -> LinearBinomial<N>[src]

Returns the derivative of the LinearBinomial.

Example

use rustnomial::{LinearBinomial, Derivable};
let binomial = LinearBinomial::new([3.0, 1.0]);
assert_eq!(LinearBinomial::new([0., 3.0]), binomial.derivative());

impl<N> Derivable<N> for Monomial<N> where
    N: Zero + Copy + Mul<Output = N> + TryFromUsizeExact, 
[src]

pub fn derivative(&self) -> Monomial<N>[src]

Returns the derivative of the Monomial.

Example

use rustnomial::{Monomial, Derivable};
let monomial = Monomial::new(3.0, 2);
assert_eq!(Monomial::new(6.0, 1), monomial.derivative());

Errors

Will panic if N can not losslessly represent the degree of self.

impl<N> Derivable<N> for Polynomial<N> where
    N: Zero + One + TryFromUsizeContinuous + Copy + MulAssign + SubAssign
[src]

pub fn derivative(&self) -> Polynomial<N>[src]

Returns the derivative of the Polynomial.

Example

use rustnomial::{Polynomial, Derivable};
let polynomial = Polynomial::new(vec![4, 1, 5]);
assert_eq!(Polynomial::new(vec![8, 1]), polynomial.derivative());

Errors

Will panic if N can not losslessly encode the numbers from 0 to the degree of self.

impl<N> Derivable<N> for QuadraticTrinomial<N> where
    N: Zero + One + Copy + Mul<Output = N> + TryFromUsizeExact, 
[src]

pub fn derivative(&self) -> QuadraticTrinomial<N>[src]

Returns the derivative of the QuadraticTrinomial.

Example

use rustnomial::{QuadraticTrinomial, Derivable};
let binomial = QuadraticTrinomial::new([3.0, 2.0, 1.0]);
assert_eq!(QuadraticTrinomial::new([0.0, 6.0, 2.0]), binomial.derivative());

impl<N> Derivable<N> for SparsePolynomial<N> where
    N: Zero + TryFromUsizeExact + Copy + Mul<Output = N>, 
[src]

pub fn derivative(&self) -> SparsePolynomial<N>[src]

Returns the derivative of the SparsePolynomial.

Example

use rustnomial::{SparsePolynomial, Derivable};
let polynomial = SparsePolynomial::from(vec![4, 1, 5]);
assert_eq!(SparsePolynomial::from(vec![8, 1]), polynomial.derivative());

Errors

Will panic if a term has a degree which does not have a lossless representation in N.

Loading content...