Struct peroxide::structure::polynomial::Polynomial [−][src]
Expand description
Polynomial Structure
Fields
coef: Vec<f64>
Implementations
impl Polynomial
[src]
impl Polynomial
[src]pub fn eval<T>(&self, x: T) -> f64 where
T: Into<f64> + Copy,
[src]
pub fn eval<T>(&self, x: T) -> f64 where
T: Into<f64> + Copy,
[src]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]
pub fn translate_x<X>(&self, x: X) -> Self where
X: Into<f64> + Copy,
[src]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]
impl Add<Polynomial> for Polynomial
[src]impl Clone for Polynomial
[src]
impl Clone for Polynomial
[src]fn clone(&self) -> Polynomial
[src]
fn clone(&self) -> Polynomial
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for Polynomial
[src]
impl Debug for Polynomial
[src]impl Default for Polynomial
[src]
impl Default for Polynomial
[src]fn default() -> Polynomial
[src]
fn default() -> Polynomial
[src]Returns the “default value” for a type. Read more
impl Display for 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]
impl Div<Polynomial> for Polynomial
[src]impl Mul<Polynomial> for Polynomial
[src]
impl Mul<Polynomial> for Polynomial
[src]impl Neg for Polynomial
[src]
impl Neg for Polynomial
[src]impl PowOps for Polynomial
[src]
impl PowOps for Polynomial
[src]impl Printable for Polynomial
[src]
impl Printable for Polynomial
[src]impl Sub<Polynomial> for Polynomial
[src]
impl Sub<Polynomial> for Polynomial
[src]impl Environment for Polynomial
[src]
Auto Trait Implementations
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,