pub enum Expr {
Val(Rc<F>),
Const(Rc<Const>),
Sum(Rc<Sum>),
Prod(Rc<Prod>),
Sqrt(Rc<Sqrt>),
}Expand description
Expression using Rc
Variants§
Val(Rc<F>)
Just a number Needs to be there, since sqrt(2)*sqrt(2) = 2
Const(Rc<Const>)
Constant like pi
Sum(Rc<Sum>)
Sum of terms Note that
Prod(Rc<Prod>)
Product of factors Notice that e.g. 2pi is already a product
Sqrt(Rc<Sqrt>)
Implementations§
Source§impl Expr
impl Expr
pub fn nan() -> Expr
pub fn infinity() -> Expr
pub fn neg_infinity() -> Expr
pub fn val_i<T>(i: T) -> Expr
pub fn val_frac(f: F) -> Expr
pub fn c_pi() -> Expr
pub fn c_e() -> Expr
pub fn sqrt_i(i: u32) -> Expr
pub fn sqrt_frac(f: F) -> Expr
pub fn sqrt_expr(expr: Expr) -> Expr
pub fn sum_i_pi(i: u32) -> Expr
pub fn sum_i_expr(i: u32, e: Expr) -> Expr
pub fn sum_i_plus_pi(i: u32) -> Expr
pub fn prod_pi_i(i: u32) -> Expr
pub fn prod_pi_times_sqrt_i(i: u32) -> Expr
Trait Implementations§
Source§impl Char for Expr
Const ->
Name of an Expr variant. Should return char
Val -> ξ
Const ->
Sum -> Σ
Prod -> Π
Sqrt -> √
For sin, cos, tan, they are a clock based on this triangle:
Cos Sin Tan
impl Char for Expr
Const ->
| / /| /| |-/ / | / | |/ /_| /_| Cos Sin Tan |/ /| _| 🕑 🕢 🕘 Sin -> 🕢 Cos -> 🕑 Tan -> 🕘
Source§impl Display for Expr
Representation. Should return a string that results in the same value
e.g. assert_eq!(exact::from(format!(“{}”,some_exact), some_exact)
For example:
1/2+1/2√(5/2) -> Σ((1/2,ξ1),(1/2,√5/2))
Note that currently constants loose precision e.g.
Const{ch: ‘π’, f64: std::consts::f64::PI} -> π
Except that bla
impl Display for Expr
Representation. Should return a string that results in the same value e.g. assert_eq!(exact::from(format!(“{}”,some_exact), some_exact) For example: 1/2+1/2√(5/2) -> Σ((1/2,ξ1),(1/2,√5/2)) Note that currently constants loose precision e.g. Const{ch: ‘π’, f64: std::consts::f64::PI} -> π Except that bla
Source§impl From<Vec<(Expr, GenericFraction<u32>)>> for Expr
From a prod-type vector: PVec
Also simplifies
Contained products should already be simplified
impl From<Vec<(Expr, GenericFraction<u32>)>> for Expr
From a prod-type vector: PVec Also simplifies Contained products should already be simplified
Source§impl GetExpr for Expr
Get the expression of a functional expression, such as Sqrt, Sin, Cos, Tan
Currently only sqrt.
√5/2 -> ξ5/2
Expr::Sqrt(Rc<Sqrt(expr)>) -> expr
impl GetExpr for Expr
Get the expression of a functional expression, such as Sqrt, Sin, Cos, Tan Currently only sqrt. √5/2 -> ξ5/2 Expr::Sqrt(Rc<Sqrt(expr)>) -> expr
Source§impl MulAssign for Expr
impl MulAssign for Expr
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreimpl 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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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