[][src]Struct series::Series

pub struct Series<Var, C: Coeff> { /* fields omitted */ }

Laurent series in a single variable up to some power

Methods

impl<Var, C: Coeff> Series<Var, C>[src]

pub fn new(var: Var, min_pow: isize, coeffs: Vec<C>) -> Series<Var, C>[src]

Create a new series

Example

This creates a series in the variable "x", starting at "x"^-1 with coefficients 1, 2, 3. In other words, the series x^-1 + 2 + 3*x + O(x^2).

let s = series::Series::new("x", -1, vec!(1,2,3));

pub fn with_cutoff(
    var: Var,
    min_pow: isize,
    cutoff_pow: isize,
    coeffs: Vec<C>
) -> Series<Var, C>
[src]

Create a new series with a given cutoff power

Example

This creates a series in the variable "x", starting at "x"^-1 with coefficients 1, 2, 3. and vanishing coefficients up to "x"^5 .In other words, the series x^-1 + 2 + 3*x + O(x^5).

let s = series::Series::with_cutoff("x", -1, 5, vec!(1,2,3));

Panics

Panics if the cutoff power is lower than the starting power

pub fn var(&self) -> &Var[src]

Get the expansion variable

Example

let s = series::Series::new("x", -1, vec!(1,2,3));
assert_eq!(s.var(), &"x");

pub fn coeff(&self, pow: isize) -> Option<&C>[src]

Get the series coefficient of the expansion variable to the given power.

Returns None if the requested power is above the highest known power. Coefficients below the leading power are zero.

Example

let s = series::Series::new("x", -1, vec!(1,2,3));
assert_eq!(s.coeff(-5), Some(&0));
assert_eq!(s.coeff(-2), Some(&0));
assert_eq!(s.coeff(-1), Some(&1));
assert_eq!(s.coeff(0), Some(&2));
assert_eq!(s.coeff(1), Some(&3));
assert_eq!(s.coeff(2), None);
assert_eq!(s.coeff(5), None);

pub fn min_pow(&self) -> isize[src]

Get the leading power of the series expansion variable

Example

let s = series::Series::new("x", -1, vec!(1,2,3));
assert_eq!(s.min_pow(), -1);

pub fn cutoff_pow(&self) -> isize[src]

Get the power of the expansion variable where the series is truncated, that is \( N \) in a series of the form \( \sum_{n=n_0}^{N-1} a_n x^n + O(x^N), \)

Example

let s = series::Series::new("x", -1, vec!(1,2,3));
assert_eq!(s.cutoff_pow(), 2);

impl<Var, C: Coeff> Series<Var, C>[src]

pub fn powi(self, exp: i32) -> Self where
    C: DivAssign<&'a C>,
    &'a C: Mul<Output = C>,
    C: Clone + SubAssign + Ln<Output = C> + Div<Output = C> + Mul<Output = C>,
    Series<Var, C>: Mul<C, Output = Self> + Exp<Output = Self> + MulInverse<Output = Self>, 
[src]

Calculate series to some integer power

In contrast to the more general pow method this does not require the variable type to be convertible to the coefficient type and gives an overall nicer output

Example

let s = series::Series::new("x", -1, vec![1.,3.,7.]);
let s_to_minus_5 = series::Series::new("x", 5, vec![1.,-15.,100.]);
assert_eq!(s.powi(-5), s_to_minus_5);

Trait Implementations

impl<Var, C: Coeff> Ln for Series<Var, C> where
    C: DivAssign<&'a C>,
    &'a C: Mul<Output = C>,
    C: Clone + SubAssign + Add<Output = C> + Mul<Output = C> + Div<Output = C> + Ln<Output = C> + From<Var>,
    Var: Clone
[src]

type Output = Self

fn ln(self) -> Self[src]

Computes the logarithm of a series

Panics

Panics if the series has no (non-zero) coefficients

impl<'a, Var, C: Coeff> Ln for &'a Series<Var, C> where
    C: Div<&'b C, Output = C>,
    &'b C: Mul<Output = C> + Ln<Output = C>,
    C: Clone + SubAssign + Add<Output = C> + Mul<Output = C> + Div<Output = C> + From<Var>,
    Var: Clone
[src]

type Output = Series<Var, C>

fn ln(self) -> Self::Output[src]

Computes the logarithm of a series

Panics

Panics if the series has no (non-zero) coefficients

impl<Var, C: Coeff> Exp for Series<Var, C> where
    &'a C: Mul<Output = C>,
    C: MulAssign<&'a C>,
    C: Clone + Div<Output = C> + Mul<Output = C> + AddAssign + Exp<Output = C>, 
[src]

type Output = Self

fn exp(self) -> Self::Output[src]

Computes the exponential of a series

Panics

Panics if the series contains negative powers of the expansion variable

impl<'a, Var, C: Coeff> Exp for &'a Series<Var, C> where
    &'b C: Mul<Output = C>,
    C: MulAssign<&'b C>,
    Var: Clone,
    C: Clone + Div<Output = C> + Mul<Output = C> + AddAssign + Exp<Output = C>, 
[src]

type Output = Series<Var, C>

fn exp(self) -> Self::Output[src]

Computes the exponential of a series

Panics

Panics if the series contains negative powers of the expansion variable

impl<Var, C: Coeff, T> Pow<T> for Series<Var, C> where
    Series<Var, C>: Ln,
    <Series<Var, C> as Ln>::Output: Mul<T>,
    <<Series<Var, C> as Ln>::Output as Mul<T>>::Output: Exp
[src]

type Output = <<<Series<Var, C> as Ln>::Output as Mul<T>>::Output as Exp>::Output

impl<'a, Var, C: Coeff, T> Pow<T> for &'a Series<Var, C> where
    &'b Series<Var, C>: Ln<Output = Series<Var, C>>,
    Series<Var, C>: Mul<T>,
    <Series<Var, C> as Mul<T>>::Output: Exp
[src]

type Output = <<Series<Var, C> as Mul<T>>::Output as Exp>::Output

impl<'a, Var: Clone, C: Coeff + SubAssign> MulInverse for &'a Series<Var, C> where
    &'b C: Div<Output = C> + Mul<Output = C>, 
[src]

type Output = Series<Var, C>

fn mul_inverse(self) -> Self::Output[src]

Compute 1/s for a series s

Example

use series::MulInverse;
let s = series::Series::new("x", -1, vec!(1.,2.,3.));
let s_inv = (&s).mul_inverse();
let one = series::Series::new("x", 0, vec!(1.,0.,0.));
assert_eq!(s * s_inv, one);

impl<Var: Clone, C: Coeff + SubAssign> MulInverse for Series<Var, C> where
    &'a Series<Var, C>: MulInverse<Output = Series<Var, C>>, 
[src]

type Output = Series<Var, C>

fn mul_inverse(self) -> Self::Output[src]

Compute 1/s for a series s

Example

use series::MulInverse;
let s = series::Series::new("x", -1, vec!(1.,2.,3.));
let s_inv = s.clone().mul_inverse();
let one = series::Series::new("x", 0, vec!(1.,0.,0.));
assert_eq!(s * s_inv, one);

impl<Var: PartialOrd, C: PartialOrd + Coeff> PartialOrd<Series<Var, C>> for Series<Var, C>[src]

impl<Var: PartialEq, C: PartialEq + Coeff> PartialEq<Series<Var, C>> for Series<Var, C>[src]

impl<Var, C: Coeff> From<Series<Var, C>> for SeriesParts<Var, C>[src]

impl<Var, C: Coeff> From<SeriesParts<Var, C>> for Series<Var, C>[src]

impl<Var: Clone, C: Clone + Coeff> Clone for Series<Var, C>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<Var: Ord, C: Ord + Coeff> Ord for Series<Var, C>[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<Var: Eq, C: Eq + Coeff> Eq for Series<Var, C>[src]

impl<Var: Display, C: Coeff + Display> Display for Series<Var, C>[src]

impl<Var: Debug, C: Debug + Coeff> Debug for Series<Var, C>[src]

impl<Var: Hash, C: Hash + Coeff> Hash for Series<Var, C>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<'a, Var: Clone, C: Coeff + Clone, Rhs> Add<Rhs> for &'a Series<Var, C> where
    Series<Var, C>: AddAssign<Rhs>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the + operator.

impl<Var: Clone, C: Coeff + Clone, Rhs> Add<Rhs> for Series<Var, C> where
    Series<Var, C>: AddAssign<Rhs>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the + operator.

impl<'a, Var, C: Coeff, T> Sub<T> for &'a Series<Var, C> where
    Series<Var, C>: Clone + SubAssign<T>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the - operator.

impl<Var, C: Coeff, T> Sub<T> for Series<Var, C> where
    Series<Var, C>: SubAssign<T>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the - operator.

impl<'a, Var, C: Coeff, T> Mul<T> for &'a Series<Var, C> where
    Series<Var, C>: Clone + MulAssign<T>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the * operator.

impl<Var, C: Coeff, T> Mul<T> for Series<Var, C> where
    Series<Var, C>: MulAssign<T>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the * operator.

impl<'a, Var, C: Coeff, T> Div<T> for &'a Series<Var, C> where
    Series<Var, C>: Clone + DivAssign<T>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the / operator.

impl<Var, C: Coeff, T> Div<T> for Series<Var, C> where
    Series<Var, C>: DivAssign<T>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the / operator.

impl<Var, C: Coeff + Neg<Output = C>> Neg for Series<Var, C>[src]

type Output = Series<Var, C>

The resulting type after applying the - operator.

fn neg(self) -> Self::Output[src]

Compute -s for a series s

Example

let s = series::Series::new("x", -3, vec!(1.,0.,-3.));
let minus_s = series::Series::new("x", -3, vec!(-1.,0.,3.));
assert_eq!(-s, minus_s);

impl<'a, Var: Clone, C: Coeff> Neg for &'a Series<Var, C> where
    &'c C: Neg<Output = C>, 
[src]

type Output = Series<Var, C>

The resulting type after applying the - operator.

fn neg(self) -> Self::Output[src]

Compute -s for a series s

Example

let s = series::Series::new("x", -3, vec!(1.,0.,-3.));
let minus_s = series::Series::new("x", -3, vec!(-1.,0.,3.));
assert_eq!(-&s, minus_s);

impl<'a, Var: PartialEq + Debug, C: Coeff + Clone> AddAssign<&'a Series<Var, C>> for Series<Var, C> where
    C: AddAssign<&'c C>, 
[src]

fn add_assign(&mut self, other: &'a Series<Var, C>)[src]

Set s = s + t for two series s and t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
let t = Series::new("x", -1, vec!(3., 4., 5.));
let res = Series::new("x", -3, vec!(1.,0.,0.));
s += &t;
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<Var, C: Coeff> AddAssign<Series<Var, C>> for Series<Var, C> where
    C: AddAssign<&'c C>,
    Var: PartialEq + Debug
[src]

fn add_assign(&mut self, other: Series<Var, C>)[src]

Set s = s + t for two series s and t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
let t = Series::new("x", -1, vec!(3., 4., 5.));
let res = Series::new("x", -3, vec!(1.,0.,0.));
s += t;
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<Var, C: Coeff + Clone> AddAssign<C> for Series<Var, C> where
    C: AddAssign<C>, 
[src]

impl<'a, Var, C: Coeff> SubAssign<&'a Series<Var, C>> for Series<Var, C> where
    &'c Series<Var, C>: Neg<Output = Series<Var, C>>,
    Series<Var, C>: AddAssign<Series<Var, C>>, 
[src]

fn sub_assign(&mut self, other: &'a Series<Var, C>)[src]

Set s = s - t for two series s and t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
let res = Series::new("x", 0, vec!());
s -= &s.clone();
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<Var, C: Coeff> SubAssign<Series<Var, C>> for Series<Var, C> where
    Series<Var, C>: AddAssign + Neg<Output = Series<Var, C>>, 
[src]

fn sub_assign(&mut self, other: Series<Var, C>)[src]

Set s = s - t for two series s and t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
let res = Series::new("x", 0, vec!());
s -= s.clone();
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<Var, C: Coeff + Clone> SubAssign<C> for Series<Var, C> where
    C: Neg<Output = C> + SubAssign<C>, 
[src]

impl<'a, Var: PartialEq + Debug, C: Coeff + Clone + AddAssign> MulAssign<&'a Series<Var, C>> for Series<Var, C> where
    &'b C: Mul<Output = C>, 
[src]

fn mul_assign(&mut self, other: &'a Series<Var, C>)[src]

Set s = s * t for two series s,t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
s *= &s.clone();
let res = Series::new("x", -6, vec!(1.,0.,-6.));
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<Var, C: Coeff> MulAssign<Series<Var, C>> for Series<Var, C> where
    Series<Var, C>: MulAssign<&'a Series<Var, C>>, 
[src]

fn mul_assign(&mut self, other: Series<Var, C>)[src]

Set s = s * t for two series s,t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
s *= &s.clone();
let res = Series::new("x", -6, vec!(1.,0.,-6.));
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<'a, Var, C: Coeff> MulAssign<&'a C> for Series<Var, C> where
    C: MulAssign<&'a C>, 
[src]

impl<Var, C: Coeff> MulAssign<C> for Series<Var, C> where
    Series<Var, C>: MulAssign<&'a C>, 
[src]

impl<'a, Var: Clone, C: Coeff + SubAssign> DivAssign<&'a Series<Var, C>> for Series<Var, C> where
    Series<Var, C>: MulAssign,
    &'b C: Div<Output = C> + Mul<Output = C>,
    &'c Series<Var, C>: MulInverse<Output = Series<Var, C>>, 
[src]

fn div_assign(&mut self, other: &'a Series<Var, C>)[src]

Sets s = s / t for two series s,t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
s /= &s.clone();
let res = Series::new("x", 0, vec!(1.,0.,0.));
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<'a, Var: Clone, C: Coeff + SubAssign> DivAssign<Series<Var, C>> for Series<Var, C> where
    Series<Var, C>: MulAssign + MulInverse<Output = Series<Var, C>>,
    &'b C: Div<Output = C> + Mul<Output = C>, 
[src]

fn div_assign(&mut self, other: Series<Var, C>)[src]

Sets s = s / t for two series s,t

Example

use series::Series;
let mut s = Series::new("x", -3, vec!(1.,0.,-3.));
s /= s.clone();
let res = Series::new("x", 0, vec!(1.,0.,0.));
assert_eq!(res, s);

Panics

Panics if the series have different expansion variables.

impl<'a, Var, C: Coeff> DivAssign<&'a C> for Series<Var, C> where
    C: DivAssign<&'a C>, 
[src]

impl<Var, C: Coeff> DivAssign<C> for Series<Var, C> where
    Series<Var, C>: DivAssign<&'a C>, 
[src]

Auto Trait Implementations

impl<Var, C> Send for Series<Var, C> where
    C: Send,
    Var: Send

impl<Var, C> Sync for Series<Var, C> where
    C: Sync,
    Var: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]