pub struct Polynomial { /* private fields */ }Expand description
A polynomial in variables numbered from 0, with rational coefficients. No coefficient is zero, so equal polynomials are structurally equal.
Implementations§
Source§impl Polynomial
impl Polynomial
pub fn zero() -> Polynomial
pub fn one() -> Polynomial
pub fn constant(c: Rational) -> Polynomial
Sourcepub fn var(i: usize) -> Polynomial
pub fn var(i: usize) -> Polynomial
Variable i.
Sourcepub fn from_univariate(p: &Poly, v: usize) -> Polynomial
pub fn from_univariate(p: &Poly, v: usize) -> Polynomial
The univariate p in variable v.
pub fn is_zero(&self) -> bool
Sourcepub fn as_constant(&self) -> Option<Rational>
pub fn as_constant(&self) -> Option<Rational>
The value of a polynomial with no variable; None for any other.
Sourcepub fn terms(&self) -> impl Iterator<Item = (&[u32], &Rational)>
pub fn terms(&self) -> impl Iterator<Item = (&[u32], &Rational)>
The terms, exponents with no trailing zero, in increasing order of exponents.
pub fn add(&self, o: &Polynomial) -> Polynomial
pub fn neg(&self) -> Polynomial
pub fn sub(&self, o: &Polynomial) -> Polynomial
pub fn scale(&self, k: &Rational) -> Polynomial
pub fn mul(&self, o: &Polynomial) -> Polynomial
pub fn pow(&self, k: u32) -> Polynomial
Sourcepub fn degree_in(&self, v: usize) -> u32
pub fn degree_in(&self, v: usize) -> u32
The degree in variable v; zero for the zero polynomial.
Sourcepub fn coefficient_in(&self, v: usize, k: u32) -> Polynomial
pub fn coefficient_in(&self, v: usize, k: u32) -> Polynomial
The coefficient of x_v^k, a polynomial in the other variables.
Sourcepub fn leading_in(&self, v: usize) -> Polynomial
pub fn leading_in(&self, v: usize) -> Polynomial
The coefficient of the highest power of x_v.
Sourcepub fn substitute(&self, v: usize, x: &Rational) -> Polynomial
pub fn substitute(&self, v: usize, x: &Rational) -> Polynomial
x_v set to x.
Sourcepub fn compose(&self, v: usize, p: &Polynomial) -> Polynomial
pub fn compose(&self, v: usize, p: &Polynomial) -> Polynomial
x_v replaced by the polynomial p.
Sourcepub fn derivative(&self, v: usize) -> Polynomial
pub fn derivative(&self, v: usize) -> Polynomial
∂/∂x_v.
Sourcepub fn to_univariate(&self, v: usize) -> Option<Poly>
pub fn to_univariate(&self, v: usize) -> Option<Poly>
The polynomial as one in x_v alone; None when another variable occurs.
Sourcepub fn resultant(&self, o: &Polynomial, v: usize) -> Polynomial
pub fn resultant(&self, o: &Polynomial, v: usize) -> Polynomial
The resultant in x_v: lc^{deg o} · Π o(α) over the roots α in x_v of self, a
polynomial in the other variables, by the univariate resultant’s convention (Poly::resultant).
Zero when either is zero; self^{deg o} when self does not hold x_v.
Trait Implementations§
Source§impl Clone for Polynomial
impl Clone for Polynomial
Source§fn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more