Struct calcu_rs::expr::Expr

source ·
pub struct Expr(Rc<Atom>);

Tuple Fields§

§0: Rc<Atom>

Implementations§

source§

impl Expr

source

pub fn undef() -> Expr

source

pub fn zero() -> Expr

source

pub fn one() -> Expr

source

pub fn min_one() -> Expr

source

pub fn var(str: &str) -> Expr

source

pub fn rational<T: Into<Rational>>(r: T) -> Expr

source

pub fn add(lhs: impl Borrow<Expr>, rhs: impl Borrow<Expr>) -> Expr

source

pub fn sub(lhs: impl Borrow<Expr>, rhs: impl Borrow<Expr>) -> Expr

source

pub fn mul(lhs: impl Borrow<Expr>, rhs: impl Borrow<Expr>) -> Expr

source

pub fn div(lhs: impl Borrow<Expr>, rhs: impl Borrow<Expr>) -> Expr

source

pub fn cos(e: impl Borrow<Expr>) -> Expr

source

pub fn sin(e: impl Borrow<Expr>) -> Expr

source

pub fn tan(e: impl Borrow<Expr>) -> Expr

source

pub fn sec(e: impl Borrow<Expr>) -> Expr

source

pub fn arc_sin(e: impl Borrow<Expr>) -> Expr

source

pub fn arc_cos(e: impl Borrow<Expr>) -> Expr

source

pub fn arc_tan(e: impl Borrow<Expr>) -> Expr

source

pub fn exp(e: impl Borrow<Expr>) -> Expr

source

pub fn log(base: impl Into<Real>, e: impl Borrow<Expr>) -> Expr

source

pub fn ln(e: impl Borrow<Expr>) -> Expr

source

pub fn log10(e: impl Borrow<Expr>) -> Expr

source

pub fn raw_pow(base: impl Borrow<Expr>, exponent: impl Borrow<Expr>) -> Expr

source

pub fn pow(base: impl Borrow<Expr>, exponent: impl Borrow<Expr>) -> Expr

source

pub fn sqrt(v: impl Borrow<Expr>) -> Expr

source

pub fn is_undef(&self) -> bool

source

fn is_primitive(&self) -> bool

source

pub fn check_real(&self, r: &Real) -> bool

source§

impl Expr

source

pub fn free_of(&self, expr: &Expr) -> bool

source

pub fn free_of_set<'a, I: IntoIterator<Item = &'a Self>>( &'a self, exprs: I, ) -> bool

source

pub fn substitude(&self, from: &Expr, to: &Expr) -> Self

source

pub fn seq_substitude<'a, T>(&self, subs: T) -> Self
where T: IntoIterator<Item = (&'a Expr, &'a Expr)>,

source

pub fn concurr_substitude<'a, T>(&self, subs: T) -> Self
where T: IntoIterator<Item = (&'a Expr, &'a Expr)> + Copy,

source

pub fn variables(&self) -> HashSet<Expr, FxBuildHasher>

source

pub fn numerator(&self) -> Expr

source

pub fn denominator(&self) -> Expr

source

pub fn base(&self) -> Expr

source

pub fn exponent(&self) -> Expr

source

fn is_const(&self) -> bool

source

pub fn const(&self) -> Option<Expr>

source

pub fn term(&self) -> Option<Expr>

source

pub fn get(&self) -> &Atom

source

pub fn get_flatten(&self) -> &Atom

source

pub fn make_mut(&mut self) -> &mut Atom

source

fn iter_args(&self) -> Box<dyn Iterator<Item = &Self> + '_>

source

fn iter_args_mut(&mut self) -> Box<dyn Iterator<Item = &mut Self> + '_>

source

fn try_for_each_compl_sub_expr<F>(&mut self, func: F)
where F: Fn(&mut Expr) -> ControlFlow<()> + Copy,

source

fn for_each_compl_sub_expr<F>(&mut self, func: F)
where F: Fn(&mut Expr) + Copy,

source

fn iter_compl_sub_exprs(&self) -> ExprIterator<'_>

source

fn variables_impl(&self, vars: &mut HashSet<Expr, FxBuildHasher>)

source§

impl Expr

source

pub fn pow_expand(base: impl Borrow<Expr>, exponent: impl Borrow<Expr>) -> Expr

source

pub fn mul_expand(lhs: impl Borrow<Expr>, rhs: impl Borrow<Expr>) -> Expr

source

pub fn derivative<T: Borrow<Self>>(&self, x: T) -> Self

source

pub fn expand(&self) -> Self

source

pub fn expand_main_op(&self) -> Self

source

pub fn distribute(&self) -> Self

source

pub fn reduce(&self) -> Self

source

pub fn as_monomial<'a>(&'a self, vars: &'a VarSet) -> MonomialView<'a>

source

pub fn as_polynomial<'a>(&'a self, vars: &'a VarSet) -> PolynomialView<'a>

source

fn rationalize_add(lhs: &Self, rhs: &Self) -> Expr

source

pub fn rationalize(&self) -> Expr

source

pub fn factorize_common_terms(lhs: &Expr, rhs: &Self) -> (Expr, (Expr, Expr))

divide lhs and rhs by their common factor and return them in the form (fac, (lhs/fac, rhs/fac)

source

pub fn common_factors(lhs: &Self, rhs: &Self) -> Expr

source

pub fn factor_out(&self) -> Expr

source

pub fn cancel(&self) -> Expr

Trait Implementations§

source§

impl<T: Borrow<Expr>> Add<T> for &Expr

§

type Output = Expr

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Borrow<Expr>> Add<T> for Expr

§

type Output = Expr

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Borrow<Expr>> AddAssign<T> for Expr

source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
source§

impl Clone for Expr

source§

fn clone(&self) -> Expr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Expr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Expr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Borrow<Expr>> Div<T> for &Expr

§

type Output = Expr

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: Borrow<Expr>> Div<T> for Expr

§

type Output = Expr

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: Borrow<Expr>> DivAssign<T> for Expr

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl From<&str> for Expr

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<Atom> for Expr

source§

fn from(value: Atom) -> Self

Converts to this type from the input type.
source§

impl From<Expr> for ReducedProd

source§

fn from(value: Expr) -> Self

Converts to this type from the input type.
source§

impl From<Expr> for VarSet

source§

fn from(value: Expr) -> Self

Converts to this type from the input type.
source§

impl From<Irrational> for Expr

source§

fn from(value: Irrational) -> Self

Converts to this type from the input type.
source§

impl From<Real> for Expr

source§

fn from(value: Real) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Rational>> From<T> for Expr

source§

fn from(value: T) -> Self

Converts to this type from the input type.
source§

impl Hash for Expr

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

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

impl<T: Borrow<Expr>> Mul<T> for &Expr

§

type Output = Expr

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: Borrow<Expr>> Mul<T> for Expr

§

type Output = Expr

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: Borrow<Expr>> MulAssign<T> for Expr

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl Ord for Expr

source§

fn cmp(&self, other: &Expr) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Expr

source§

fn eq(&self, other: &Expr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Expr

source§

fn partial_cmp(&self, other: &Expr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: Borrow<Expr>> Sub<T> for &Expr

§

type Output = Expr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Borrow<Expr>> Sub<T> for Expr

§

type Output = Expr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Borrow<Expr>> SubAssign<T> for Expr

source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
source§

impl Eq for Expr

source§

impl StructuralPartialEq for Expr

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl !Send for Expr

§

impl !Sync for Expr

§

impl Unpin for Expr

§

impl UnwindSafe for Expr

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<T, U> ExactFrom<T> for U
where U: TryFrom<T>,

§

fn exact_from(value: T) -> U

§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

§

fn exact_into(self) -> U

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

§

fn overflowing_into(self) -> (U, bool)

§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

§

fn rounding_into(self, rm: RoundingMode) -> (U, Ordering)

§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

§

fn saturating_into(self) -> U

§

impl<T> ToDebugString for T
where T: Debug,

§

fn to_debug_string(&self) -> String

Returns the String produced by Ts Debug implementation.

§Examples
use malachite_base::strings::ToDebugString;

assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
    [vec![2, 3], vec![], vec![4]].to_debug_string(),
    "[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

§

fn wrapping_into(self) -> U