Struct series::Series

source ·
pub struct Series<Var, C: Coeff> { /* private fields */ }
Expand description

Laurent series in a single variable up to some power

Implementations

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));

Get the expansion variable

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

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);

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);

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.max_pow(), 2);

Trait Implementations

The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more

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.

Performs the += operation. Read more

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.

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the / operator.
Performs the / operation. Read more
The resulting type after applying the / operator.
Performs the / operation. Read more
Performs the /= operation. Read more

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.

Performs the /= operation. Read more

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.

Computes the exponential of a series

Panics

Panics if the series contains negative powers of the expansion variable

Computes the exponential of a series

Panics

Panics if the series contains negative powers of the expansion variable

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

Computes the logarithm of a series

Panics

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

Computes the logarithm of a series

Panics

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

The resulting type after applying the * operator.
Performs the * operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
Performs the *= operation. Read more

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.

Performs the *= operation. Read more

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.

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);

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);

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);
The resulting type after applying the - operator.

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);
The resulting type after applying the - operator.
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Computes s^t for two series s,t

Panics

Panics if the series have different expansion variables, s is zero, or t contains negative powers of the expansion variable

Computes s^t for two series s,t

Panics

Panics if the series have different expansion variables, s is zero, or t contains negative powers of the expansion variable

Computes s^t for two series s,t

Panics

Panics if the series have different expansion variables, s is zero, or t contains negative powers of the expansion variable

Computes s^t for two series s,t

Panics

Panics if the series have different expansion variables, s is zero, or t contains negative powers of the expansion variable

The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more

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.

Performs the -= operation. Read more

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.