[−][src]Struct peroxide::structure::polynomial::Polynomial
Polynomial Structure
Fields
coef: Vec<f64>
Implementations
impl Polynomial
[src]
pub fn new(coef: Vec<f64>) -> Self
[src]
Create Polynomial
pub fn eval<T>(&self, x: T) -> f64 where
T: Into<f64> + Copy,
[src]
T: Into<f64> + Copy,
Evaluate polynomial with value according to Horner's method
Examples
#[macro_use] extern crate peroxide; use peroxide::fuga::*; fn main() { let a = poly(c!(1,3,2)); assert_eq!(a.eval(1), 6_f64); let b = poly(c!(1, 1, -2, -2)); let x = 2_f64.sqrt(); let horner_evaluation = b.eval(x); let naive_evaluation = x.powf(3.0) + x.powf(2.0) - 2.0*x - 2.0; assert_eq!(horner_evaluation, 0_f64); assert_ne!(naive_evaluation, horner_evaluation); }
pub fn eval_vec(&self, v: Vec<f64>) -> Vec<f64>
[src]
pub fn translate_x<X>(&self, x: X) -> Self where
X: Into<f64> + Copy,
[src]
X: Into<f64> + Copy,
Linear transformation of a polynomial by a given x according to Horner's method
Examples
#[macro_use] extern crate peroxide; use peroxide::fuga::*; fn main() { let a = poly(c!(1,3,2)); let translated = a.translate_x(2); assert_eq!(translated.eval(3), 6_f64); }
Trait Implementations
impl Add<Polynomial> for Polynomial
[src]
type Output = Self
The resulting type after applying the +
operator.
pub fn add(self, other: Self) -> Self
[src]
impl<T> Add<T> for Polynomial where
T: Into<f64> + Copy,
[src]
T: Into<f64> + Copy,
type Output = Self
The resulting type after applying the +
operator.
pub fn add(self, other: T) -> Self
[src]
impl Calculus for Polynomial
[src]
impl Clone for Polynomial
[src]
pub fn clone(&self) -> Polynomial
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Polynomial
[src]
impl Default for Polynomial
[src]
pub fn default() -> Polynomial
[src]
impl Display for Polynomial
[src]
Polynomial Print
Examples
#[macro_use] extern crate peroxide; use peroxide::fuga::*; fn main() { let a = poly(c!(1,3,2)); a.print(); //x^2 + 3x + 2 }
impl Div<Polynomial> for Polynomial
[src]
type Output = (Self, Self)
The resulting type after applying the /
operator.
pub fn div(self, other: Self) -> Self::Output
[src]
impl<T> Div<T> for Polynomial where
T: Into<f64> + Copy,
[src]
T: Into<f64> + Copy,
type Output = Self
The resulting type after applying the /
operator.
pub fn div(self, other: T) -> Self
[src]
impl Environment for Polynomial
[src]
impl Mul<Polynomial> for Polynomial
[src]
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, other: Self) -> Self
[src]
impl<T> Mul<T> for Polynomial where
T: Into<f64> + Copy,
[src]
T: Into<f64> + Copy,
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, other: T) -> Self
[src]
impl Neg for Polynomial
[src]
type Output = Self
The resulting type after applying the -
operator.
pub fn neg(self) -> Self::Output
[src]
impl PowOps for Polynomial
[src]
pub fn powi(&self, n: i32) -> Self
[src]
pub fn powf(&self, _f: f64) -> Self
[src]
pub fn pow(&self, _f: Self) -> Self
[src]
pub fn sqrt(&self) -> Self
[src]
impl Printable for Polynomial
[src]
impl Sub<Polynomial> for Polynomial
[src]
type Output = Self
The resulting type after applying the -
operator.
pub fn sub(self, other: Self) -> Self
[src]
impl<T> Sub<T> for Polynomial where
T: Into<f64> + Copy,
[src]
T: Into<f64> + Copy,
Auto Trait Implementations
impl RefUnwindSafe for Polynomial
[src]
impl Send for Polynomial
[src]
impl Sync for Polynomial
[src]
impl Unpin for Polynomial
[src]
impl UnwindSafe for Polynomial
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,