pub struct Rational {
pub num: isize,
pub denom: isize,
}Fields§
§num: isize§denom: isizeImplementations§
Trait Implementations§
Source§impl AddAssign for Rational
impl AddAssign for Rational
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl DivAssign<&Rational> for Rational
impl DivAssign<&Rational> for Rational
Source§fn div_assign(&mut self, rhs: &Rational)
fn div_assign(&mut self, rhs: &Rational)
Performs the
/= operation. Read moreSource§impl DivAssign for Rational
impl DivAssign for Rational
Source§fn div_assign(&mut self, rhs: Rational)
fn div_assign(&mut self, rhs: Rational)
Performs the
/= operation. Read moreSource§impl Expr for Rational
impl Expr for Rational
fn known_expr(&self) -> KnownExpr<'_>
fn for_each_arg(&self, f: &mut dyn FnMut(&dyn Arg))
fn from_args(&self, args: Vec<Box<dyn Arg>>) -> Box<dyn Expr>
fn clone_box(&self) -> Box<dyn Expr>
fn str(&self) -> String
fn to_cpp(&self) -> String
fn get_ref<'a>(&'a self) -> &'a dyn Expr
fn is_one(&self) -> bool
fn is_zero(&self) -> bool
fn is_neg_one(&self) -> bool
fn is_number(&self) -> bool
fn is_negative_number(&self) -> bool
fn as_f64(&self) -> Option<f64>
fn simplify(&self) -> Box<dyn Expr>
fn as_expr(&self) -> Option<Box<dyn Expr>>
fn args(&self) -> Vec<Box<dyn Arg>>
fn args_map_exprs( &self, _f: &dyn Fn(&dyn Expr) -> Box<dyn Arg>, ) -> Vec<Box<dyn Arg>>
fn as_arg(&self) -> Box<dyn Arg>
fn as_function(&self) -> Option<&Func>
fn equals(&self, other: &dyn Expr) -> bool
fn as_symbol(&self) -> Option<Symbol>
fn as_eq(&self) -> Option<Equation>
fn as_mul(&self) -> Option<&Mul>
fn as_pow(&self) -> Option<&Pow>
fn simplify_with_dimension(&self, dim: usize) -> Box<dyn Expr>
fn as_int(&self) -> Option<Integer>
fn pow(&self, exponent: &Box<dyn Expr>) -> Box<dyn Expr>
fn ipow(&self, exponent: isize) -> Box<dyn Expr>
fn sqrt(&self) -> Box<dyn Expr>
fn get_exponent(&self) -> (Box<dyn Expr>, Box<dyn Expr>)
fn diff(&self, var: &str, order: usize) -> Box<dyn Expr>
fn name(&self) -> String
fn subs(&self, substitutions: &[[Box<dyn Expr>; 2]]) -> Box<dyn Expr>
fn has(&self, expr: &dyn Expr) -> bool
fn has_box(&self, expr: Box<dyn Expr>) -> bool
Source§fn factor(&self, factors: &[&dyn Expr]) -> Box<dyn Expr>
fn factor(&self, factors: &[&dyn Expr]) -> Box<dyn Expr>
Factorizes an expression
For example:
factor(ax + cx + zy, [x]) -> (a + c)x + zy
fn terms<'a>(&'a self) -> Box<dyn Iterator<Item = &'a dyn Expr> + 'a>
fn get_coeff(&self) -> (Rational, Box<dyn Expr>)
fn compare(&self, other: &dyn Expr) -> Option<Ordering>
fn evaluate(&self, vars: Option<HashMap<Symbol, BoxExpr>>) -> BoxExpr
Source§impl<I: ToPrimitive> Mul<I> for Rational
impl<I: ToPrimitive> Mul<I> for Rational
Source§impl<I: ToPrimitive> MulAssign<&I> for Rational
impl<I: ToPrimitive> MulAssign<&I> for Rational
Source§fn mul_assign(&mut self, rhs: &I)
fn mul_assign(&mut self, rhs: &I)
Performs the
*= operation. Read moreSource§impl MulAssign<&Rational> for Rational
impl MulAssign<&Rational> for Rational
Source§fn mul_assign(&mut self, rhs: &Rational)
fn mul_assign(&mut self, rhs: &Rational)
Performs the
*= operation. Read moreSource§impl Ord for Rational
impl Ord for Rational
Source§impl<T: Copy + Into<Rational>> PartialOrd<T> for Rational
impl<T: Copy + Into<Rational>> PartialOrd<T> for Rational
impl Copy for Rational
impl Eq for Rational
Auto Trait Implementations§
impl Freeze for Rational
impl RefUnwindSafe for Rational
impl Send for Rational
impl Sync for Rational
impl Unpin for Rational
impl UnwindSafe for Rational
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> ExprOperations for Twhere
T: Expr,
impl<T> ExprOperations for Twhere
T: Expr,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more